Hi
We have a number of scheduled task setup of reboot, all task name start with "Scheduled Reboot of < ServerName>". Also within the description it has a starts with "Agreed Scheduled Reboot of <ServerName> by Service Owner(See Ticket#IT-xxxx)
I wanted to ask is there a way i can use cli to change
All Task Name from "Scheduled Reboot of < ServerName>" to Recurring Reboot of < ServerName>
Also change part of description from "Agreed Scheduled Reboot of <ServerName> by Service Owner(See Ticket#IT-xxxx)" to "Recurring Reboot of <ServerName> - " but keep the Ticket#IT-xxxx part as this unique to each task
Here is the script as i that i have and would appreciate your help thank you
$si = Get-View ServiceInstance
$schedMgr = Get-View -Id $si.Content.ScheduledTaskManager
Get-View -Id $schedMgr.ScheduledTask | where{$_.Info.Name -match "^Scheduled Reboot of"} |
ForEach-Object -Process {
$spec = New-Object VMware.Vim.ScheduledTaskSpec
$spec.Enabled = $true
$spec.Action = $_.Info.Action
$spec.Description = "Recurring Reboot of ", $vm.Name -join ' ' **not sure how i can keep the last part of the description ***
$spec.Name = "Recurring Reboot of ", $vm.Name -join ' '
$spec.Notification = $_.Info.Notification
$spec.Scheduler = $_.Info.Scheduler
$_.ReconfigureScheduledTask($spec)
}
Recurring Reboot of