简体   繁体   English

如何在Windows Server 2008 R2上通过Powershell 4.0创建计划任务?

[英]How can I create scheduled tasks via Powershell 4.0 on Windows Server 2008 R2?

I have installed Powershell 4.0 on my OS that is Windows Server 2008 R2 . 我已经在Windows Server 2008 R2的操作系统上安装了Powershell 4.0。

I wanted to create ScheduledTasks by using Scheduled Tasks Cmdlets but it seems they are available only for Windows Server 2012 or Windows 8.1. 我想通过使用计划任务Cmdlet创建ScheduledTasks,但似乎它们仅适用于Windows Server 2012或Windows 8.1。

QUESTION : What is the shortest way to create scheduled tasks via Powershell 4.0 on Windows Server 2008 R2? 问题 :在Windows Server 2008 R2上通过Powershell 4.0创建计划任务的最短方法是什么?

You could use the TaskScheduler module released as part of the PowerShell Pack . 您可以使用作为PowerShell Pack的一部分发布的TaskScheduler模块。 Here is a sample of what you can do with that module: 以下是该模块的示例:

New-task | 
    Add-TaskTrigger -DayOfWeek Monday, Wednesday, Friday -WeeksInterval 2 -At "3:00 PM" |
    Add-TaskAction -Script { 
        Get-Process | Out-GridView 
        Start-Sleep -Seconds 100
    } |
    Register-ScheduledTask TestTask

New-task | 
    Add-TaskTrigger -In (New-TimeSpan -Seconds 30) |
    Add-TaskAction -Script { 
        Get-Process | Out-GridView 
        Start-Sleep -Seconds 100
    } |
    Register-ScheduledTask TestTask

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我可以使用Powershell Server 2008 R2创建dhcp保留吗 - Can I create dhcp reservation with powershell server 2008 r2 如何使用Powershell在Windows Server 2008 R2上管理本地用户帐户? - How can I manage local useraccounts on windows server 2008 r2 with powershell? 在Windows 2012 R2中使用Powershell导入计划任务 - Importing Scheduled Tasks with Powershell in Windows 2012 R2 如何在Windows 2008 R2域控制器上本地获取有关具有Powershell的RootDSE的信息 - How can I get information about the RootDSE with Powershell locally on a Windows 2008 R2 Domain Controller 如何创建用户组并通过Powershell / cmd Windows Server 2012 R2将组策略链接到他们 - How to create group of users and link group policy to them via powershell/cmd Windows Server 2012 R2 使用Windows Server 2008 R2上的Com对象通过PowerShell在特定NIC上禁用IPV6? - Disable IPV6 on specific NIC via PowerShell using a Com Object on Windows Server 2008 R2? 如何在 windows 服务器 2008 R2 中获得总虚拟内存 - How can I get total virtual-memory in windows server 2008 R2 Windows Server 2008 R2 PowerShell和Internet Explorer 9 - Windows Server 2008 R2 PowerShell and Internet Explorer 9 使用Powershell Windows Server 2008 R2将用户导入本地 - Import users to local with powershell windows server 2008 r2 更改芬兰语Windows Server 2008 R2上Powershell脚本的文化 - Change culture on Finnish Windows Server 2008 R2 for Powershell Script
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM