<?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: for loop on vcenters - list skipping on fail in vSphere Update Manager PowerCLI Discussions</title>
    <link>https://communities.vmware.com/t5/vSphere-Update-Manager-PowerCLI/for-loop-on-vcenters-list-skipping-on-fail/m-p/1784482#M420</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks. I added 'Disconnect-VIServer * -Force -Confirm:$False' but there is an issue when one of them fail:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="xml" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14377861204277712" jivemacro_uid="_14377861204277712"&gt;
&lt;P&gt;Time :: host :: Runtime (seconds)&lt;/P&gt;
&lt;P&gt;12:06:49 :: bavc1 :: 1286.3862268&lt;/P&gt;
&lt;P&gt;13:17:41 :: bvc1:: 4252.2041729&lt;/P&gt;
&lt;P&gt;13:30:23 :: lvc1:: 761.6258825&lt;/P&gt;
&lt;P&gt;13:30:30 :: lxdvc :: EXCEPTION!&lt;/P&gt;
&lt;P&gt;13:34:00 :: lxvc1:: EXCEPTION!&lt;/P&gt;
&lt;P&gt;13:37:28 :: nvc2:: EXCEPTION!&lt;/P&gt;
&lt;P&gt;13:40:55 :: svc1:: EXCEPTION!&lt;/P&gt;
&lt;P&gt;13:46:52 :: stavc1:: EXCEPTION!&lt;/P&gt;
&lt;P&gt;13:53:28 :: zvc1:: EXCEPTION!&lt;/P&gt;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I restricted the get-vm to get-vm *abc* to speed up the troubleshooting and found the culprit - there was a global attribute missing one of the vc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="xml" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14377863755872500" jivemacro_uid="_14377863755872500"&gt;
&lt;P&gt;Time :: host :: Runtime (seconds)&lt;/P&gt;
&lt;P&gt;21:01:56 :: bavc1 :: 54.4264154&lt;/P&gt;
&lt;P&gt;21:02:23 :: bvc1 :: 27.2972137&lt;/P&gt;
&lt;P&gt;21:02:29 :: lvc1 :: 5.9372769&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: #ff0000;"&gt;21:02:36 :: lxdvc :: EXCEPTION!&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;21:02:51 :: lxvc1 :: EXCEPTION!&lt;/P&gt;
&lt;P&gt;21:03:04 :: nvc2 :: EXCEPTION!&lt;/P&gt;
&lt;P&gt;21:03:16 :: svc1 :: EXCEPTION!&lt;/P&gt;
&lt;P&gt;21:03:32 :: stavc1 :: EXCEPTION!&lt;/P&gt;
&lt;P&gt;21:03:50 :: zvc1 :: EXCEPTION!&lt;/P&gt;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;By the question is 1) why it skip and HALT! the rest when it fail? 2) Is this new in powercli 6.0? it never happen in 5.5 or older.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="xml" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14377865767933552" jivemacro_uid="_14377865767933552"&gt;
&lt;P&gt;21:06:38 :: bavc1 :: 30.5933593&lt;/P&gt;
&lt;P&gt;21:06:52 :: bvc1 :: 13.7796256&lt;/P&gt;
&lt;P&gt;21:06:57 :: lvc1 :: 5.4512553&lt;/P&gt;
&lt;P&gt;21:07:09 :: lxvc1 :: 12.2495468&lt;/P&gt;
&lt;P&gt;21:07:22 :: nvc2 :: 12.1385508&lt;/P&gt;
&lt;P&gt;21:07:27 :: svc1 :: 5.1842234&lt;/P&gt;
&lt;P&gt;21:07:31 :: stavc1 :: 4.1381707&lt;/P&gt;
&lt;P&gt;21:07:37 :: zvc1 :: 5.6402636&lt;/P&gt;

&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 25 Jul 2015 01:14:52 GMT</pubDate>
    <dc:creator>mazdajai</dc:creator>
    <dc:date>2015-07-25T01:14:52Z</dc:date>
    <item>
      <title>for loop on vcenters - list skipping on fail</title>
      <link>https://communities.vmware.com/t5/vSphere-Update-Manager-PowerCLI/for-loop-on-vcenters-list-skipping-on-fail/m-p/1784477#M415</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a for loop get-vm statement against a list of vcenters with try/catch. For some reason when one of the vcenter fails, the remaining will fail and will not run.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sample list of vcenters.inputs:&lt;/P&gt;&lt;P&gt;BadVC1&lt;/P&gt;&lt;P&gt;GoodVC1 &amp;lt;---will not run if BadVC1 fails&lt;/P&gt;&lt;P&gt;GoodVC2&amp;lt;---will not run if BadVC1 fails&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="c#" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14376815802371440 jive_text_macro" jivemacro_uid="_14376815802371440" modifiedtitle="true"&gt;
&lt;P&gt;$pwd='d:\';&lt;/P&gt;
&lt;P&gt;$vcenters=gc vcenters.input | sort;&lt;/P&gt;
&lt;P&gt;$invuser='xxx';&lt;/P&gt;
&lt;P&gt;$invpass='xxx';&lt;/P&gt;
&lt;P&gt;$outlog="$(Get-Date -uformat %m%e%g)_run.log";&lt;/P&gt;
&lt;P&gt;$errlog='error.log';&lt;/P&gt;
&lt;P&gt;"Time :: host :: Runtime (seconds)" | Out-file -Encoding UTF8 $outlog&lt;/P&gt;
&lt;P&gt;"$MyInvocation.MyCommand.Definition" | Out-file -Encoding UTF8 $errlog&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;foreach ($vcenter in $vcenters) {&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $startsec=Get-Date&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $outfile=$vcenter+"_inv.csv"&lt;/P&gt;
&lt;P&gt;try&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; connect-viserver $vcenter -User $vcenter\$invuser -Password $invpass&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $Report = @()&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Get-VM | % {&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $vmcls = $_ | Get-Cluster&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $vmnet = $_ | Get-NetworkAdapter&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $vmds = $_ | Get-Datastore&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $vms = "" | Select-Object Cluster, Host, Name, FQDN, State, OS, Network, Memory, CPU, ServerRole, `&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PatchGroup, DataStore, ProvisionedGB, ConsumedGB, Contact, PVU, Replicated, Notes&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $vms.Cluster = $vmcls.Name&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $vms.Host = $_.VMHost&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $vms.Name = $_.Name&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $vms.FQDN = $_.Guest.HostName&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $vms.State = $_.PowerState&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $vms.OS = $_.Guest.OSFullName&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $vms.Network = $vmnet.NetworkName&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $vms.Memory = $_.MemoryMB&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $vms.CPU = $_.NumCpu&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $vms.ServerRole = $_.CustomFields.Item("ServerRole")&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $vms.PatchGroup = $_.CustomFields.Item("PatchGroup")&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $vms.DataStore = $vmds.Name&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $vms.ProvisionedGB = $_.ProvisionedSpaceGB&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $vms.ConsumedGB = $_.UsedSpaceGB&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $vms.Contact = $_.CustomFields.Item("System Contact")&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $vms.PVU = $_.CustomFields.Item("PVU")&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $vms.Replicated = $_.CustomFields.Item("Replicated")&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $vms.Notes = $_.Notes&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $Report += $vms&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $Report | ConvertTo-csv | Out-file -Encoding UTF8 $pwd\data\$outfile&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Disconnect-VIServer $vcenter -confirm:$false&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $endsec=Get-Date;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "$(Get-Date -uformat %H:%M:%S) :: $vcenter :: $((New-TimeSpan -Start $startsec -End $endsec).TotalSeconds)" | Out-file -Encoding UTF8 -Append $outlog&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;catch&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;"$(Get-Date -uformat %H:%M:%S) :: $vcenter :: EXCEPTION" | Out-file -Encoding UTF8 -Append $outlog&lt;/P&gt;
&lt;P&gt;$error | Out-file -Encoding UTF8 -Append $errlog&lt;/P&gt;
&lt;P&gt;}&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;};&lt;/P&gt;
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Jul 2015 20:09:46 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/vSphere-Update-Manager-PowerCLI/for-loop-on-vcenters-list-skipping-on-fail/m-p/1784477#M415</guid>
      <dc:creator>mazdajai</dc:creator>
      <dc:date>2015-07-23T20:09:46Z</dc:date>
    </item>
    <item>
      <title>Re: for loop on vcenters - list skipping on fail</title>
      <link>https://communities.vmware.com/t5/vSphere-Update-Manager-PowerCLI/for-loop-on-vcenters-list-skipping-on-fail/m-p/1784478#M416</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try adding a Continue statement to the end of the Catch block&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Jul 2015 20:41:06 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/vSphere-Update-Manager-PowerCLI/for-loop-on-vcenters-list-skipping-on-fail/m-p/1784478#M416</guid>
      <dc:creator>LucD</dc:creator>
      <dc:date>2015-07-23T20:41:06Z</dc:date>
    </item>
    <item>
      <title>Re: for loop on vcenters - list skipping on fail</title>
      <link>https://communities.vmware.com/t5/vSphere-Update-Manager-PowerCLI/for-loop-on-vcenters-list-skipping-on-fail/m-p/1784479#M417</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No luck. &lt;img id="smileysad" class="emoticon emoticon-smileysad" src="https://communities.vmware.com/i/smilies/16x16_smiley-sad.png" alt="Smiley Sad" title="Smiley Sad" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have attached an error.log that I send $error to.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="xml" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14376870549254585" jivemacro_uid="_14376870549254585"&gt;
&lt;P&gt;catch&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;"$(Get-Date -uformat %H:%M:%S) :: $vcenter :: EXCEPTION" | Out-file -Encoding UTF8 -Append $outlog&lt;/P&gt;
&lt;P&gt;$error | Out-file -Encoding UTF8 -Append $errlog&lt;/P&gt;
&lt;P&gt;continue&lt;/P&gt;
&lt;P&gt;} &lt;/P&gt;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="xml" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14376869014587173" jivemacro_uid="_14376869014587173"&gt;
&lt;P&gt;Time :: host :: Runtime (seconds)&lt;/P&gt;
&lt;P&gt;17:11:40 :: BADVC1:: EXCEPTION&lt;/P&gt;
&lt;P&gt;17:18:50 :: GoodVC1:: EXCEPTION&lt;/P&gt;

&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Jul 2015 21:31:19 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/vSphere-Update-Manager-PowerCLI/for-loop-on-vcenters-list-skipping-on-fail/m-p/1784479#M417</guid>
      <dc:creator>mazdajai</dc:creator>
      <dc:date>2015-07-23T21:31:19Z</dc:date>
    </item>
    <item>
      <title>Re: for loop on vcenters - list skipping on fail</title>
      <link>https://communities.vmware.com/t5/vSphere-Update-Manager-PowerCLI/for-loop-on-vcenters-list-skipping-on-fail/m-p/1784480#M418</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Updated:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I closed the powercli prompt and re-run the script, it seems to be working (with or without the continue statement). It seems like it happens when it has previous connection to the VCs. If I open a new powercli prompt, I don't get the error. I have a line to disconnect-viserver, does it not working? Is there a way to cleanly clear all VC session?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Jul 2015 21:57:33 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/vSphere-Update-Manager-PowerCLI/for-loop-on-vcenters-list-skipping-on-fail/m-p/1784480#M418</guid>
      <dc:creator>mazdajai</dc:creator>
      <dc:date>2015-07-23T21:57:33Z</dc:date>
    </item>
    <item>
      <title>Re: for loop on vcenters - list skipping on fail</title>
      <link>https://communities.vmware.com/t5/vSphere-Update-Manager-PowerCLI/for-loop-on-vcenters-list-skipping-on-fail/m-p/1784481#M419</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Disconnect-VIServer * -Force -Confirm:$False&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;will kill your sessions to all connected servers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One thing to keep in mind is if your code runs Connect-VIServer &lt;EM&gt;servername&lt;/EM&gt; multiple times (or your code runs Connect-VIServer and stops before the matching Disconnect-VIServer and you run your script a bunch of times), then you have to run Disconnect-VIServer &lt;EM&gt;servername &lt;/EM&gt;an equal number of times to get fully disconnected. Using * -Force disconnects everything.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;$Global:DefaultVIServers | Where-Object {$_.RefCount -gt 1}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;will show you which servers have been connected multiple times...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Jul 2015 04:10:27 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/vSphere-Update-Manager-PowerCLI/for-loop-on-vcenters-list-skipping-on-fail/m-p/1784481#M419</guid>
      <dc:creator>Craig_Baltzer</dc:creator>
      <dc:date>2015-07-24T04:10:27Z</dc:date>
    </item>
    <item>
      <title>Re: for loop on vcenters - list skipping on fail</title>
      <link>https://communities.vmware.com/t5/vSphere-Update-Manager-PowerCLI/for-loop-on-vcenters-list-skipping-on-fail/m-p/1784482#M420</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks. I added 'Disconnect-VIServer * -Force -Confirm:$False' but there is an issue when one of them fail:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="xml" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14377861204277712" jivemacro_uid="_14377861204277712"&gt;
&lt;P&gt;Time :: host :: Runtime (seconds)&lt;/P&gt;
&lt;P&gt;12:06:49 :: bavc1 :: 1286.3862268&lt;/P&gt;
&lt;P&gt;13:17:41 :: bvc1:: 4252.2041729&lt;/P&gt;
&lt;P&gt;13:30:23 :: lvc1:: 761.6258825&lt;/P&gt;
&lt;P&gt;13:30:30 :: lxdvc :: EXCEPTION!&lt;/P&gt;
&lt;P&gt;13:34:00 :: lxvc1:: EXCEPTION!&lt;/P&gt;
&lt;P&gt;13:37:28 :: nvc2:: EXCEPTION!&lt;/P&gt;
&lt;P&gt;13:40:55 :: svc1:: EXCEPTION!&lt;/P&gt;
&lt;P&gt;13:46:52 :: stavc1:: EXCEPTION!&lt;/P&gt;
&lt;P&gt;13:53:28 :: zvc1:: EXCEPTION!&lt;/P&gt;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I restricted the get-vm to get-vm *abc* to speed up the troubleshooting and found the culprit - there was a global attribute missing one of the vc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="xml" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14377863755872500" jivemacro_uid="_14377863755872500"&gt;
&lt;P&gt;Time :: host :: Runtime (seconds)&lt;/P&gt;
&lt;P&gt;21:01:56 :: bavc1 :: 54.4264154&lt;/P&gt;
&lt;P&gt;21:02:23 :: bvc1 :: 27.2972137&lt;/P&gt;
&lt;P&gt;21:02:29 :: lvc1 :: 5.9372769&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: #ff0000;"&gt;21:02:36 :: lxdvc :: EXCEPTION!&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;21:02:51 :: lxvc1 :: EXCEPTION!&lt;/P&gt;
&lt;P&gt;21:03:04 :: nvc2 :: EXCEPTION!&lt;/P&gt;
&lt;P&gt;21:03:16 :: svc1 :: EXCEPTION!&lt;/P&gt;
&lt;P&gt;21:03:32 :: stavc1 :: EXCEPTION!&lt;/P&gt;
&lt;P&gt;21:03:50 :: zvc1 :: EXCEPTION!&lt;/P&gt;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;By the question is 1) why it skip and HALT! the rest when it fail? 2) Is this new in powercli 6.0? it never happen in 5.5 or older.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="xml" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14377865767933552" jivemacro_uid="_14377865767933552"&gt;
&lt;P&gt;21:06:38 :: bavc1 :: 30.5933593&lt;/P&gt;
&lt;P&gt;21:06:52 :: bvc1 :: 13.7796256&lt;/P&gt;
&lt;P&gt;21:06:57 :: lvc1 :: 5.4512553&lt;/P&gt;
&lt;P&gt;21:07:09 :: lxvc1 :: 12.2495468&lt;/P&gt;
&lt;P&gt;21:07:22 :: nvc2 :: 12.1385508&lt;/P&gt;
&lt;P&gt;21:07:27 :: svc1 :: 5.1842234&lt;/P&gt;
&lt;P&gt;21:07:31 :: stavc1 :: 4.1381707&lt;/P&gt;
&lt;P&gt;21:07:37 :: zvc1 :: 5.6402636&lt;/P&gt;

&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 25 Jul 2015 01:14:52 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/vSphere-Update-Manager-PowerCLI/for-loop-on-vcenters-list-skipping-on-fail/m-p/1784482#M420</guid>
      <dc:creator>mazdajai</dc:creator>
      <dc:date>2015-07-25T01:14:52Z</dc:date>
    </item>
    <item>
      <title>Re: for loop on vcenters - list skipping on fail</title>
      <link>https://communities.vmware.com/t5/vSphere-Update-Manager-PowerCLI/for-loop-on-vcenters-list-skipping-on-fail/m-p/1784483#M421</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I suspect that you're getting caught up in some Try/Catch stuff. For cmdlets its important that the error action is "stop" when you're using Try/Catch, and that's not the default for all cmdlets (you can try throwing an "-ErrorAction Stop" on all of the cmdlet calls).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also the common coding pattern for controllable errors is to use -ErrorAction and -ErrorVariable to handle things gracefully rather than Try/Catch (try/catch also makes it hard to clean up after yourself (i.e. if "connect-viserver" fails then you don't need to do a "disconnect-viserver" in the catch, however if you ended up in the catch because Get-VM failed, then you should do a disconnect-viserver)). So as an alternative&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Connect-VIServer $vcenter -User $vcenter\$invuser -Password $invpass -ErrorAction SilentlyContinue -ErrorVariable Err&lt;/P&gt;&lt;P&gt;If ($Err -ne $Null) {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Write logs to say connect failed or do whatever else you want to do. Since this is granular you can write something specific about the error in the log rather than just "Exception"&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;Else {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # continue on with the rest of your processing. If you're worried about Get-VM or other cmdlets failing, then use the same coding pattern to check for errors&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 26 Jul 2015 07:14:58 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/vSphere-Update-Manager-PowerCLI/for-loop-on-vcenters-list-skipping-on-fail/m-p/1784483#M421</guid>
      <dc:creator>Craig_Baltzer</dc:creator>
      <dc:date>2015-07-26T07:14:58Z</dc:date>
    </item>
  </channel>
</rss>

