powershell脚本:批量注册/取消windows cluster task

前端之家收集整理的这篇文章主要介绍了powershell脚本:批量注册/取消windows cluster task前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

首先创建普通计划任务,定好执行时间,千万千万记得设置任务的起始路径.

然后导出xml到指定目录,执行如下脚本批量注册/取消windows cluster task:


function ImportTasks( [String]$xmlPath,[String]$clusterName)

{ #[String]$root,#taskpath is not support in cluster task $files = Get-ChildItem $xmlPath foreach($f in $files) { #if xml $name = $f.Name.Substring(0,$f.Name.Length-4) $fullName = $xmlPath + "\" + $f.Name $userfile = Get-Content $fullName | Out-String Register-ClusteredScheduledTask –Cluster $clusterName –TaskName $name –TaskType AnyNode -Xml $userfile # Unregister-ClusteredScheduledTask –Cluster devCluster –TaskName $name } } ImportTasks "C:\Work\TaskJobs\Surveryapp" "devCluster"
原文链接:https://www.f2er.com/windows/372658.html

猜你在找的Windows相关文章