简体   繁体   English

Powershell 中集群计划任务的每月触发器

[英]Monthly trigger for Cluster Scheduled task in Powershell

I am facing a problem with triggers for the Clustered monthly task on Windows 2012 server via Powershell, I am a novice in scripting and looking help on this issue.我在 Windows 2012 服务器上通过 Powershell 遇到了集群每月任务的触发器问题,我是脚本新手并在此问题上寻求帮助。

Below is the 'Powershell commands' trying to run the task every month 29th以下是每月 29 日尝试运行任务的“Powershell 命令”

$Trigger = New-ScheduledTaskTrigger -At 05:00am -Daily
if ((Get-Date).day -eq 29) { $action= New-ScheduledTaskAction -Execute "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -Argument "E:\SCRIPTS\TaskScheduler\Test123.ps1" }
Register-ClusteredScheduledTask –Cluster "Taskserver01.contoso.com" –TaskType AnyNode –Action $action –Trigger $trigger –TaskName Test123

Finally got this to work.终于让这个工作了。 I have applied the if condition in the action PowerShell script and it is working.我在动作 PowerShell 脚本中应用了 if 条件,它正在工作。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM