<?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: VMware.Vim.VirtualMachineRelocateSpec clarification in VMware PowerCLI Discussions</title>
    <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/VMware-Vim-VirtualMachineRelocateSpec-clarification/m-p/1379383#M43932</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I made some further tests and I discovered that:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;If I don't specify any host and any pool and the VM is powered on, a task to change the datastore is created&lt;/LI&gt;&lt;LI&gt;If I don't specify any host and any pool and the VM is powered off, a task to change either host and datastore is created&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Is there any way to specify that I want only to change the datastore because my VM is powered on?&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;marius&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 07 Apr 2016 12:30:58 GMT</pubDate>
    <dc:creator>MariusRoma</dc:creator>
    <dc:date>2016-04-07T12:30:58Z</dc:date>
    <item>
      <title>VMware.Vim.VirtualMachineRelocateSpec clarification</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/VMware-Vim-VirtualMachineRelocateSpec-clarification/m-p/1379379#M43928</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I try to run a script to create scheduled tasks to move VMs from one datastore to a different one.&lt;/P&gt;&lt;P&gt;I use the &lt;STRONG&gt;VMware.Vim.VirtualMachineRelocateSpec&lt;/STRONG&gt; object to specify where each VM must be relocated.&lt;/P&gt;&lt;P&gt;I want to change only the deatastore, not the host, but while creating the scheduled tast I cannot specify "Change datastore" because "Change both host and datastore" is selected anyway.&lt;/P&gt;&lt;P&gt;This is a problem if the VM is powered on...&lt;/P&gt;&lt;P&gt;Can anybody please help?&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;marius&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Apr 2016 15:43:31 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/VMware-Vim-VirtualMachineRelocateSpec-clarification/m-p/1379379#M43928</guid>
      <dc:creator>MariusRoma</dc:creator>
      <dc:date>2016-04-06T15:43:31Z</dc:date>
    </item>
    <item>
      <title>Re: VMware.Vim.VirtualMachineRelocateSpec clarification</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/VMware-Vim-VirtualMachineRelocateSpec-clarification/m-p/1379380#M43929</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As per official API documentation@ &lt;SPAN style="color: #387c2c; font-family: proxima-nova, Arial, sans-serif; font-size: 18px; font-weight: bold; line-height: 1.5em;"&gt;VMware.Vim.VirtualMachineRelocateSpec , &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;We can just specify target datastore, hence any vSphere SDK + PowerCLI also must honor it. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you please post your script here? &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Apr 2016 16:11:36 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/VMware-Vim-VirtualMachineRelocateSpec-clarification/m-p/1379380#M43929</guid>
      <dc:creator>vThinkBeyondVM</dc:creator>
      <dc:date>2016-04-06T16:11:36Z</dc:date>
    </item>
    <item>
      <title>Re: VMware.Vim.VirtualMachineRelocateSpec clarification</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/VMware-Vim-VirtualMachineRelocateSpec-clarification/m-p/1379381#M43930</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Per the documentation, you don't have to specify a host when setting up the specification. Thus, leaving the host property unset should work as a valid relocation spec.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Apr 2016 02:20:00 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/VMware-Vim-VirtualMachineRelocateSpec-clarification/m-p/1379381#M43930</guid>
      <dc:creator>aaron416</dc:creator>
      <dc:date>2016-04-07T02:20:00Z</dc:date>
    </item>
    <item>
      <title>Re: VMware.Vim.VirtualMachineRelocateSpec clarification</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/VMware-Vim-VirtualMachineRelocateSpec-clarification/m-p/1379382#M43931</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In include my script, based on what suggested by LucD while answering to my prevuous post &lt;A href="https://communities.vmware.com/message/2580005"&gt;Creating scheduled tasks&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt; font-family: 'courier new', courier;"&gt;#&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&lt;SPAN&gt;# Based on da &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://www.lucd.info/2009/10/18/scheduled-tasks-methodaction/" rel="nofollow"&gt;http://www.lucd.info/2009/10/18/scheduled-tasks-methodaction/&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;#&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;Add-PSSnapin VMware.VimAutomation.Core &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;Connect-VIServer &amp;lt;IP Address&amp;gt; -User &amp;lt;username&amp;gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;$csvName = "E:\Test.csv"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;$tgtDatastore = &amp;lt;target datastore name&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;$emailAddr = &amp;lt;my e-mail address&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;$startTime = [Datetime]"10/21/2016 20:00" # late in the future, just to see if the script works&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;$startInterval = 5&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;$si = get-view ServiceInstance&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;$scheduledTaskManager = Get-View $si.Content.ScheduledTaskManager&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;$offset = 0&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;Import-Csv $csvName | % {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;$a = $_.VMname&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;$a&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;$vm = Get-View -ViewType VirtualMachine -Filter @{"Name"=$_.VMname}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;$spec = New-Object VMware.Vim.ScheduledTaskSpec&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;$spec.Name = "svMotion " + $_.VMname&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;$spec.Description = "Migrate " + $_.VMname + " to " + $tgtDatastore&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;$spec.Enabled = $true&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;$spec.Notification = $emailAddr&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;$spec.Scheduler = New-Object VMware.Vim.OnceTaskScheduler&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;$spec.Scheduler.runat = $startTime.AddMinutes($offset)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;$offset += $startInterval&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;$spec.Action = New-Object VMware.Vim.MethodAction&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;$spec.Action.Name = "RelocateVM_Task"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;$arg1 = New-Object VMware.Vim.MethodActionArgument&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;$arg1.Value = New-Object&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;$arg1.Value.datastore = (Get-Datastore $tgtDatastore | Get-View).MoRef&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;$arg1.Value.pool = $vm.ResourcePool&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;$arg1.Value.host = $vm.Runtime.Host&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;$arg1.Value.host&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;$spec.Action.Argument += $arg1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;$arg2 = New-Object VMware.Vim.MethodActionArgument&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;$arg2.Value = [VMware.Vim.VirtualMachineMovePriority]"defaultPriority"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;$spec.Action.Argument += $arg2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;$scheduledTaskManager.CreateScheduledTask($vm.MoRef, $spec)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt; font-family: 'courier new', courier;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt; font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: arial, helvetica, sans-serif;"&gt;The scheduled task creation is fine, but the task is based on changing both host and datastore.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: arial, helvetica, sans-serif;"&gt;How can I change the settings?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: arial, helvetica, sans-serif;"&gt;Regards&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: arial, helvetica, sans-serif;"&gt;marius&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: arial, helvetica, sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt; font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Apr 2016 10:19:18 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/VMware-Vim-VirtualMachineRelocateSpec-clarification/m-p/1379382#M43931</guid>
      <dc:creator>MariusRoma</dc:creator>
      <dc:date>2016-04-07T10:19:18Z</dc:date>
    </item>
    <item>
      <title>Re: VMware.Vim.VirtualMachineRelocateSpec clarification</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/VMware-Vim-VirtualMachineRelocateSpec-clarification/m-p/1379383#M43932</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I made some further tests and I discovered that:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;If I don't specify any host and any pool and the VM is powered on, a task to change the datastore is created&lt;/LI&gt;&lt;LI&gt;If I don't specify any host and any pool and the VM is powered off, a task to change either host and datastore is created&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Is there any way to specify that I want only to change the datastore because my VM is powered on?&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;marius&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Apr 2016 12:30:58 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/VMware-Vim-VirtualMachineRelocateSpec-clarification/m-p/1379383#M43932</guid>
      <dc:creator>MariusRoma</dc:creator>
      <dc:date>2016-04-07T12:30:58Z</dc:date>
    </item>
    <item>
      <title>Re: VMware.Vim.VirtualMachineRelocateSpec clarification</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/VMware-Vim-VirtualMachineRelocateSpec-clarification/m-p/1379384#M43933</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I made a further test in a lab environment and I noticed that the tasks created with the script work fine, even if they look to be set in the wrong way.&lt;/P&gt;&lt;P&gt;I apologize for dubiting...&lt;/P&gt;&lt;P&gt;Many thanks to LucD.&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;marius&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Apr 2016 13:48:16 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/VMware-Vim-VirtualMachineRelocateSpec-clarification/m-p/1379384#M43933</guid>
      <dc:creator>MariusRoma</dc:creator>
      <dc:date>2016-04-07T13:48:16Z</dc:date>
    </item>
  </channel>
</rss>

