<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Creating a Scheduled Task for a VM in VMware PowerCLI Discussions</title>
    <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Creating-a-Scheduled-Task-for-a-VM/m-p/1423183#M47945</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Don't feel bad, this one was a hard one to figure out.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="color: #d4d4d4; background-color: #1e1e1e; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 12px;"&gt;&lt;/P&gt;&lt;DIV&gt;&lt;SPAN style="color: #569cd6;"&gt;function&lt;/SPAN&gt; &lt;SPAN style="color: #dcdcaa;"&gt;Get-vCenterScheduledTask&lt;/SPAN&gt;{&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #608b4e;"&gt;&amp;lt;#&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #608b4e;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #608b4e;"&gt;.&lt;/SPAN&gt;SYNOPSIS&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #608b4e;"&gt;&amp;nbsp; Retrieve vCenter Scheduled Tasks.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #608b4e;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #608b4e;"&gt;.&lt;/SPAN&gt;DESCRIPTION&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #608b4e;"&gt;&amp;nbsp; Retrieve vCenter Scheduled Tasks.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #608b4e;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #608b4e;"&gt;.&lt;/SPAN&gt;NOTES&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #608b4e;"&gt;&amp;nbsp; Source: Automating vSphere Administration&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #608b4e;"&gt;&amp;nbsp; Authors: Luc Dekens, Arnim van Lieshout, Jonathan Medd,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #608b4e;"&gt;&amp;nbsp; Alan Renouf, Glenn Sizemore&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #608b4e;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #608b4e;"&gt;.&lt;/SPAN&gt;EXAMPLE&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #608b4e;"&gt;&amp;nbsp; Get-vCenterScheduledTask | Select-Object Name,Description,NextRunTime,PrevRunTime,State,Notification&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #608b4e;"&gt;&amp;nbsp; #&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #569cd6;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;si&lt;/SPAN&gt; = &lt;SPAN style="color: #dcdcaa;"&gt;Get-View&lt;/SPAN&gt; ServiceInstance&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #569cd6;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;scheduledTaskManager&lt;/SPAN&gt; = &lt;SPAN style="color: #dcdcaa;"&gt;Get-View&lt;/SPAN&gt; &lt;SPAN style="color: #569cd6;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;si&lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;.Content.ScheduledTaskManager&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #569cd6;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;tasks&lt;/SPAN&gt; = &lt;SPAN style="color: #569cd6;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;scheduledTaskManager&lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;.RetrieveEntityScheduledTask&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;($null)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #569cd6;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;scheduledtasks&lt;/SPAN&gt; = &lt;SPAN style="color: #c586c0;"&gt;foreach&lt;/SPAN&gt; &lt;SPAN style="color: #569cd6;"&gt;($&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;task&lt;/SPAN&gt; &lt;SPAN style="color: #c586c0;"&gt;in&lt;/SPAN&gt; &lt;SPAN style="color: #569cd6;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;tasks&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;)&lt;/SPAN&gt;{&lt;SPAN style="color: #569cd6;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;Get-View&lt;/SPAN&gt; &lt;SPAN style="color: #569cd6;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;task&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;)&lt;/SPAN&gt;.info}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #569cd6;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;scheduledtasks&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In your particular case, you can pull for specific VM by using the the "RetrieveObjectScheduledTask" Method like so:&lt;/P&gt;&lt;P&gt;$si = Get-View ServiceInstance&lt;/P&gt;&lt;P&gt;$scheduledTaskManager = Get-view $si.content.ScheduledTaskManager&lt;/P&gt;&lt;P&gt;$tasksforVM = $scheduledTaskManager.RetrieveObjectScheduledTask($vm.extensiondata.moref)&lt;/P&gt;&lt;P&gt;$scheduledtasksforVM = foreach ($task in $tasksforVM){(get-view $task).info}&lt;/P&gt;&lt;P&gt;$scheduledtasksforVM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example to reconfigure an existing scheduled task:&lt;/P&gt;&lt;P style="color: #d4d4d4; background-color: #1e1e1e; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 12px;"&gt;&lt;/P&gt;&lt;DIV&gt;&lt;SPAN style="color: #9cdcfe;"&gt;vmsch&lt;/SPAN&gt; = &lt;SPAN style="color: #dcdcaa;"&gt;Get-vCenterScheduledTask&lt;/SPAN&gt; | &lt;SPAN style="color: #c586c0;"&gt;where&lt;/SPAN&gt; {&lt;SPAN style="color: #569cd6;"&gt;$&lt;/SPAN&gt;_&lt;SPAN style="color: #dcdcaa;"&gt;.Name&lt;/SPAN&gt; -match &lt;SPAN style="color: #ce9178;"&gt;"something completely idiotic so nothing bad happens by running this without knowing what they are doing"&lt;/SPAN&gt;}&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #c586c0;"&gt;Foreach&lt;/SPAN&gt; &lt;SPAN style="color: #569cd6;"&gt;($&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;task&lt;/SPAN&gt; &lt;SPAN style="color: #c586c0;"&gt;in&lt;/SPAN&gt; &lt;SPAN style="color: #569cd6;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;vmsch&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #569cd6;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;spec&lt;/SPAN&gt; = &lt;SPAN style="color: #dcdcaa;"&gt;New-Object&lt;/SPAN&gt; VMware.Vim.ScheduledTaskSpec&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #569cd6;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;spec&lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;.name&lt;/SPAN&gt; = &lt;SPAN style="color: #569cd6;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;task&lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;.name&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #569cd6;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;spec&lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;.description&lt;/SPAN&gt; = &lt;SPAN style="color: #569cd6;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;task&lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;.description&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #569cd6;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;spec&lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;.enabled&lt;/SPAN&gt; = &lt;SPAN style="color: #569cd6;"&gt;$true&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #569cd6;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;spec&lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;.scheduler&lt;/SPAN&gt; = &lt;SPAN style="color: #dcdcaa;"&gt;New-Object&lt;/SPAN&gt; VMware.Vim.OnceTaskScheduler&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #569cd6;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;spec&lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;.scheduler.runAt&lt;/SPAN&gt; = &lt;SPAN style="color: #569cd6;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;task&lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;.scheduler.runAt&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #569cd6;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;spec&lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;.action&lt;/SPAN&gt; = &lt;SPAN style="color: #dcdcaa;"&gt;New-Object&lt;/SPAN&gt; VMware.Vim.MethodAction&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #569cd6;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;spec&lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;.action.name&lt;/SPAN&gt; = &lt;SPAN style="color: #ce9178;"&gt;"CreateSnapshot_Task"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #569cd6;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;spec&lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;.action.argument&lt;/SPAN&gt; = &lt;SPAN style="color: #dcdcaa;"&gt;New-Object&lt;/SPAN&gt; VMware.Vim.MethodActionArgument&lt;SPAN style="color: #9cdcfe;"&gt;[]&lt;/SPAN&gt; &lt;SPAN style="color: #569cd6;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;4&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #569cd6;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;spec&lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;.action.argument&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;[&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;]&lt;/SPAN&gt; = &lt;SPAN style="color: #dcdcaa;"&gt;New-Object&lt;/SPAN&gt; VMware.Vim.MethodActionArgument&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #569cd6;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;spec&lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;.action.argument&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;[&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;]&lt;/SPAN&gt;.value = &lt;SPAN style="color: #ce9178;"&gt;""&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #569cd6;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;spec&lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;.action.argument&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;[&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;]&lt;/SPAN&gt; = &lt;SPAN style="color: #dcdcaa;"&gt;New-Object&lt;/SPAN&gt; VMware.Vim.MethodActionArgument&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #569cd6;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;spec&lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;.action.argument&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;[&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;]&lt;/SPAN&gt;.value = &lt;SPAN style="color: #ce9178;"&gt;""&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #569cd6;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;spec&lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;.action.argument&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;[&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;2&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;]&lt;/SPAN&gt; = &lt;SPAN style="color: #dcdcaa;"&gt;New-Object&lt;/SPAN&gt; VMware.Vim.MethodActionArgument&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #569cd6;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;spec&lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;.action.argument&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;[&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;2&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;]&lt;/SPAN&gt;.value = &lt;SPAN style="color: #569cd6;"&gt;$true&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #569cd6;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;spec&lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;.action.argument&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;[&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;3&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;]&lt;/SPAN&gt; = &lt;SPAN style="color: #dcdcaa;"&gt;New-Object&lt;/SPAN&gt; VMware.Vim.MethodActionArgument&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #569cd6;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;spec&lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;.action.argument&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;[&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;3&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;]&lt;/SPAN&gt;.value = &lt;SPAN style="color: #569cd6;"&gt;$false&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #569cd6;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;spec&lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;.notification&lt;/SPAN&gt; = &lt;SPAN style="color: #ce9178;"&gt;""&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;SPAN style="color: #569cd6;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;_this&lt;/SPAN&gt; = &lt;SPAN style="color: #dcdcaa;"&gt;Get-View&lt;/SPAN&gt; -Id &lt;SPAN style="color: #569cd6;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;task&lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;.ScheduledTask&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #569cd6;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;_this&lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;.ReconfigureScheduledTask&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;($&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;spec&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 20 Sep 2017 02:51:18 GMT</pubDate>
    <dc:creator>Zsoldier</dc:creator>
    <dc:date>2017-09-20T02:51:18Z</dc:date>
    <item>
      <title>Creating a Scheduled Task for a VM</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Creating-a-Scheduled-Task-for-a-VM/m-p/1423182#M47944</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Currently I know how to create a task for a VM for a scheduled&amp;nbsp; recurring nightly task through the Web client, but I can't seem to figure out a way to create a task via PowerCLI.&amp;nbsp; Hopefully I'm just missing something really obvious.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ultimately what I'd like to do is be able to something like search for a VM using Get-VM -VM $vmname and pipe that to return any scheduled tasks that vm has and if it currently doesn't have one then I'd love to be able to set a new task. In the context of my current use case, just simply scheduling a nightly reboot.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorry if I'm just missing something obvious, I'm just starting to dive into PowerCLI and loving what I can do so far.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Sep 2017 01:43:10 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Creating-a-Scheduled-Task-for-a-VM/m-p/1423182#M47944</guid>
      <dc:creator>glowery</dc:creator>
      <dc:date>2017-09-20T01:43:10Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a Scheduled Task for a VM</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Creating-a-Scheduled-Task-for-a-VM/m-p/1423183#M47945</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Don't feel bad, this one was a hard one to figure out.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="color: #d4d4d4; background-color: #1e1e1e; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 12px;"&gt;&lt;/P&gt;&lt;DIV&gt;&lt;SPAN style="color: #569cd6;"&gt;function&lt;/SPAN&gt; &lt;SPAN style="color: #dcdcaa;"&gt;Get-vCenterScheduledTask&lt;/SPAN&gt;{&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #608b4e;"&gt;&amp;lt;#&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #608b4e;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #608b4e;"&gt;.&lt;/SPAN&gt;SYNOPSIS&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #608b4e;"&gt;&amp;nbsp; Retrieve vCenter Scheduled Tasks.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #608b4e;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #608b4e;"&gt;.&lt;/SPAN&gt;DESCRIPTION&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #608b4e;"&gt;&amp;nbsp; Retrieve vCenter Scheduled Tasks.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #608b4e;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #608b4e;"&gt;.&lt;/SPAN&gt;NOTES&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #608b4e;"&gt;&amp;nbsp; Source: Automating vSphere Administration&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #608b4e;"&gt;&amp;nbsp; Authors: Luc Dekens, Arnim van Lieshout, Jonathan Medd,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #608b4e;"&gt;&amp;nbsp; Alan Renouf, Glenn Sizemore&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #608b4e;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #608b4e;"&gt;.&lt;/SPAN&gt;EXAMPLE&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #608b4e;"&gt;&amp;nbsp; Get-vCenterScheduledTask | Select-Object Name,Description,NextRunTime,PrevRunTime,State,Notification&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #608b4e;"&gt;&amp;nbsp; #&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #569cd6;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;si&lt;/SPAN&gt; = &lt;SPAN style="color: #dcdcaa;"&gt;Get-View&lt;/SPAN&gt; ServiceInstance&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #569cd6;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;scheduledTaskManager&lt;/SPAN&gt; = &lt;SPAN style="color: #dcdcaa;"&gt;Get-View&lt;/SPAN&gt; &lt;SPAN style="color: #569cd6;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;si&lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;.Content.ScheduledTaskManager&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #569cd6;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;tasks&lt;/SPAN&gt; = &lt;SPAN style="color: #569cd6;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;scheduledTaskManager&lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;.RetrieveEntityScheduledTask&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;($null)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #569cd6;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;scheduledtasks&lt;/SPAN&gt; = &lt;SPAN style="color: #c586c0;"&gt;foreach&lt;/SPAN&gt; &lt;SPAN style="color: #569cd6;"&gt;($&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;task&lt;/SPAN&gt; &lt;SPAN style="color: #c586c0;"&gt;in&lt;/SPAN&gt; &lt;SPAN style="color: #569cd6;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;tasks&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;)&lt;/SPAN&gt;{&lt;SPAN style="color: #569cd6;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;Get-View&lt;/SPAN&gt; &lt;SPAN style="color: #569cd6;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;task&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;)&lt;/SPAN&gt;.info}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #569cd6;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;scheduledtasks&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In your particular case, you can pull for specific VM by using the the "RetrieveObjectScheduledTask" Method like so:&lt;/P&gt;&lt;P&gt;$si = Get-View ServiceInstance&lt;/P&gt;&lt;P&gt;$scheduledTaskManager = Get-view $si.content.ScheduledTaskManager&lt;/P&gt;&lt;P&gt;$tasksforVM = $scheduledTaskManager.RetrieveObjectScheduledTask($vm.extensiondata.moref)&lt;/P&gt;&lt;P&gt;$scheduledtasksforVM = foreach ($task in $tasksforVM){(get-view $task).info}&lt;/P&gt;&lt;P&gt;$scheduledtasksforVM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example to reconfigure an existing scheduled task:&lt;/P&gt;&lt;P style="color: #d4d4d4; background-color: #1e1e1e; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 12px;"&gt;&lt;/P&gt;&lt;DIV&gt;&lt;SPAN style="color: #9cdcfe;"&gt;vmsch&lt;/SPAN&gt; = &lt;SPAN style="color: #dcdcaa;"&gt;Get-vCenterScheduledTask&lt;/SPAN&gt; | &lt;SPAN style="color: #c586c0;"&gt;where&lt;/SPAN&gt; {&lt;SPAN style="color: #569cd6;"&gt;$&lt;/SPAN&gt;_&lt;SPAN style="color: #dcdcaa;"&gt;.Name&lt;/SPAN&gt; -match &lt;SPAN style="color: #ce9178;"&gt;"something completely idiotic so nothing bad happens by running this without knowing what they are doing"&lt;/SPAN&gt;}&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #c586c0;"&gt;Foreach&lt;/SPAN&gt; &lt;SPAN style="color: #569cd6;"&gt;($&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;task&lt;/SPAN&gt; &lt;SPAN style="color: #c586c0;"&gt;in&lt;/SPAN&gt; &lt;SPAN style="color: #569cd6;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;vmsch&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #569cd6;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;spec&lt;/SPAN&gt; = &lt;SPAN style="color: #dcdcaa;"&gt;New-Object&lt;/SPAN&gt; VMware.Vim.ScheduledTaskSpec&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #569cd6;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;spec&lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;.name&lt;/SPAN&gt; = &lt;SPAN style="color: #569cd6;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;task&lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;.name&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #569cd6;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;spec&lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;.description&lt;/SPAN&gt; = &lt;SPAN style="color: #569cd6;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;task&lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;.description&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #569cd6;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;spec&lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;.enabled&lt;/SPAN&gt; = &lt;SPAN style="color: #569cd6;"&gt;$true&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #569cd6;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;spec&lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;.scheduler&lt;/SPAN&gt; = &lt;SPAN style="color: #dcdcaa;"&gt;New-Object&lt;/SPAN&gt; VMware.Vim.OnceTaskScheduler&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #569cd6;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;spec&lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;.scheduler.runAt&lt;/SPAN&gt; = &lt;SPAN style="color: #569cd6;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;task&lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;.scheduler.runAt&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #569cd6;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;spec&lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;.action&lt;/SPAN&gt; = &lt;SPAN style="color: #dcdcaa;"&gt;New-Object&lt;/SPAN&gt; VMware.Vim.MethodAction&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #569cd6;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;spec&lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;.action.name&lt;/SPAN&gt; = &lt;SPAN style="color: #ce9178;"&gt;"CreateSnapshot_Task"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #569cd6;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;spec&lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;.action.argument&lt;/SPAN&gt; = &lt;SPAN style="color: #dcdcaa;"&gt;New-Object&lt;/SPAN&gt; VMware.Vim.MethodActionArgument&lt;SPAN style="color: #9cdcfe;"&gt;[]&lt;/SPAN&gt; &lt;SPAN style="color: #569cd6;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;4&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #569cd6;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;spec&lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;.action.argument&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;[&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;]&lt;/SPAN&gt; = &lt;SPAN style="color: #dcdcaa;"&gt;New-Object&lt;/SPAN&gt; VMware.Vim.MethodActionArgument&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #569cd6;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;spec&lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;.action.argument&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;[&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;]&lt;/SPAN&gt;.value = &lt;SPAN style="color: #ce9178;"&gt;""&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #569cd6;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;spec&lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;.action.argument&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;[&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;]&lt;/SPAN&gt; = &lt;SPAN style="color: #dcdcaa;"&gt;New-Object&lt;/SPAN&gt; VMware.Vim.MethodActionArgument&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #569cd6;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;spec&lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;.action.argument&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;[&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;]&lt;/SPAN&gt;.value = &lt;SPAN style="color: #ce9178;"&gt;""&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #569cd6;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;spec&lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;.action.argument&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;[&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;2&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;]&lt;/SPAN&gt; = &lt;SPAN style="color: #dcdcaa;"&gt;New-Object&lt;/SPAN&gt; VMware.Vim.MethodActionArgument&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #569cd6;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;spec&lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;.action.argument&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;[&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;2&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;]&lt;/SPAN&gt;.value = &lt;SPAN style="color: #569cd6;"&gt;$true&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #569cd6;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;spec&lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;.action.argument&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;[&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;3&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;]&lt;/SPAN&gt; = &lt;SPAN style="color: #dcdcaa;"&gt;New-Object&lt;/SPAN&gt; VMware.Vim.MethodActionArgument&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #569cd6;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;spec&lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;.action.argument&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;[&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;3&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;]&lt;/SPAN&gt;.value = &lt;SPAN style="color: #569cd6;"&gt;$false&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #569cd6;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;spec&lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;.notification&lt;/SPAN&gt; = &lt;SPAN style="color: #ce9178;"&gt;""&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;SPAN style="color: #569cd6;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;_this&lt;/SPAN&gt; = &lt;SPAN style="color: #dcdcaa;"&gt;Get-View&lt;/SPAN&gt; -Id &lt;SPAN style="color: #569cd6;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;task&lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;.ScheduledTask&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #569cd6;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;_this&lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;.ReconfigureScheduledTask&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;($&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;spec&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Sep 2017 02:51:18 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Creating-a-Scheduled-Task-for-a-VM/m-p/1423183#M47945</guid>
      <dc:creator>Zsoldier</dc:creator>
      <dc:date>2017-09-20T02:51:18Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a Scheduled Task for a VM</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Creating-a-Scheduled-Task-for-a-VM/m-p/1423184#M47946</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Awesome, thank you! I'll give this a shot, but it already looks like exactly what I was looking for.&amp;nbsp; I didn't even think to go to using the method.&amp;nbsp; I even have that book in my collection....doh!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Sep 2017 04:01:27 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Creating-a-Scheduled-Task-for-a-VM/m-p/1423184#M47946</guid>
      <dc:creator>glowery</dc:creator>
      <dc:date>2017-09-20T04:01:27Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a Scheduled Task for a VM</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Creating-a-Scheduled-Task-for-a-VM/m-p/1423185#M47947</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;SPAN&gt;&lt;/SPAN&gt;&lt;P&gt;i can't figure out how to use this script to create a new scheduled task for a VM using this script&lt;/P&gt;&lt;SPAN&gt;&lt;/SPAN&gt;&lt;P&gt;my goal is to reboot on a weekly basis every sunday night with a task in vcenter&lt;/P&gt;&lt;SPAN&gt;&lt;/SPAN&gt;&lt;P&gt;i have roughly 700 VM and i need to add a reboot task in vcenter for each vm&lt;/P&gt;&lt;SPAN&gt;&lt;/SPAN&gt;&lt;P&gt;any help will be appreciated&lt;/P&gt;&lt;SPAN&gt;&lt;/SPAN&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;SPAN&gt;&lt;/SPAN&gt;&lt;P&gt;boudjel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Jun 2018 11:59:12 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Creating-a-Scheduled-Task-for-a-VM/m-p/1423185#M47947</guid>
      <dc:creator>boudjel38xpo</dc:creator>
      <dc:date>2018-06-12T11:59:12Z</dc:date>
    </item>
  </channel>
</rss>

