Powershell 4 Get-ScheduledTask 和 Windows [英] Powershell 4 Get-ScheduledTask and Windows
问题描述
我认为无论您使用什么操作系统,如果您安装了 Powershell,您都可以访问相同的默认 cmdlet.
I thought no matter what OS you had, if you had Powershell installed, you would have access to the same default cmdlets.
所以我想在我的 Windows 上使用 Get-ScheduledTask7 机.我安装了 Powershell 4.但是,当我运行它时,出现错误:
So I want to use Get-ScheduledTask on my Windows 7 machine. I have Powershell 4 installed. However, when I run it, I get the error:
Get-ScheduledTask : The term 'Get-ScheduledTask' is not recognized as the name
of a cmdlet, function, script file, or operable program. Check the spelling of
the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ Get-ScheduledTask
+ ~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-ScheduledTask:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
如果我在我的 Windows 8.1 上运行 Powershell 4 已经与操作系统一起预装,它可以工作.
If I run on my Windows 8.1 with Powershell 4 already pre-installed along with the OS, it works.
我可以在我的 Windows 7 机器上获取 cmdlet 吗?Microsoft Get-ScheduledTask 页面上没有关于 Windows 7 的任何内容,所以我猜不是.
Can I get the cmdlets on my Windows 7 machine? There is nothing on the Microsoft Get-ScheduledTask page about Windows 7 so I am guessing not.
如果不是,那会不会是使用命令行的情况:
If not then would it be a case of using the command line:
毫无疑问有人会指向我这个问题 但那是针对 Powershell 2 的.我使用的是 Powershell 4.
No doubt someone will point me at this question but that was for Powershell 2. I am on Powershell 4.
现在我非常喜欢不重新发明轮子,但是这个 伙计们 看起来是个不错的选择.
Now I am a big fan of not reinventing the wheel, but this guys scripts look a good alternative.
推荐答案
Get-ScheduledTask
依赖于 Windows 7 没有的操作系统的底层功能,因此无法运行该操作系统上的 cmdlet,即使使用 PowerShell v4.在您的情况下,您可以利用 schtasks.exe
或 Schedule.Service
COM 对象.
Get-ScheduledTask
relies on underlying features of the OS that Windows 7 doesn't have, so there is no way to run the cmdlet on that OS, even with PowerShell v4. In your case, you can either leverage schtasks.exe
or the Schedule.Service
COM object.
您链接的这个答案给出了这些方法的最佳概述,但为了完整起见,我将在此处链接相关资源:
This answer that you linked gives the best overview of these methods, but in the interests of completeness, I'll link the relevant resources here:
MS PowerShellPack TaskScheduler 模块 ->(利用Schedule.Service
COM 对象)
MS PowerShellPack TaskScheduler module -> (leverages the Schedule.Service
COM object)
这篇关于Powershell 4 Get-ScheduledTask 和 Windows的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!