<?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: How do I  exit PowerCLI on an error in a script running in Windows Scheduler in VMware PowerCLI Discussions</title>
    <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/How-do-I-exit-PowerCLI-on-an-error-in-a-script-running-in/m-p/2985733#M113145</link>
    <description>&lt;P&gt;Thanks Luc&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I mean the username password for connecting to vcenter with&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;Connect-VIServer&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;When that happened, the connection failed and the cloning did not take place for that day and the names were off by a few days.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;So, i think the ..&lt;/SPAN&gt;&lt;SPAN&gt;Get-VM -Name $oldCloneName -ErrorAction SilentlyContinue | Remove-VM -DeletePermanently:$true -Confirm:$false failed&amp;nbsp;because the oldCloneName is based on a day that there was no cloning&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Let me add the block and see if it catches the issue.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 07 Sep 2023 15:36:33 GMT</pubDate>
    <dc:creator>stanj</dc:creator>
    <dc:date>2023-09-07T15:36:33Z</dc:date>
    <item>
      <title>How do I  exit PowerCLI on an error in a script running in Windows Scheduler</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/How-do-I-exit-PowerCLI-on-an-error-in-a-script-running-in/m-p/2985725#M113143</link>
      <description>&lt;P&gt;I have the below script that runs that will clone a VM (found this is s Luc D script).&amp;nbsp; It was working, but then the account password changed so the task failed.&amp;nbsp; But, task&amp;nbsp;scheduler still shows it completed and the script running which wil lkick off at 9PM - (below is what is in the task Scheduler under the Task Actions)&lt;/P&gt;&lt;P&gt;&lt;FONT color="#800080"&gt;c:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe e:\CLIscripts\CloneVMidm02.ps1&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;If for some reason the VM is removed or there is an issue, the task scheduler still shows the script runs, but i see no error.&lt;/P&gt;&lt;P&gt;What do i need to add to the below so that if an error occurs,&amp;nbsp; the error is shown in a log or in the task scheduler History?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Assume the connection is made to vCenter with an encrypted password&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080"&gt;$vcenter_server = "vcenter7"&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080"&gt;$user = 'maint1@vsphere.local'&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#000080"&gt;$Folder = “IDM02 Clones”&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#000080"&gt;$vmName = 'idm02'&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#333399"&gt;Connect-VIServer -Server $vcenter_server -User $user -Password $decryptedPassword&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#333399"&gt;Set-PowerCLIConfiguration -DisplayDeprecationWarning:$true&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#333399"&gt;$ds = Get-Datastore | where{$_.Type -eq 'VMFS' -and $_.ExtensionData.Summary.MultipleHostAccess} |&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;Sort-Object -Property FreeSpaceGB -Descending | select -First 1&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#333399"&gt;$esx = Get-Cluster -VM $vmName | Get-VMHost | Get-Random&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#333399"&gt;#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;# Set up cloning names -&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#333399"&gt;$cloneName = "$($vmName)-clone-$((Get-Date).ToString('MMddyyyy'))"&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;$oldCloneName = "$($vmName)-clone-$((Get-Date).AddDays(-1).ToString('MMddyyyy'))"&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#333399"&gt;#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;# Get the idm02 clone and remove the day before clone&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#333399"&gt;Get-VM -Name $oldCloneName -ErrorAction SilentlyContinue |&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;Remove-VM -DeletePermanently:$true -Confirm:$false&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;# Clone idm02 to current&amp;nbsp;day&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;#&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#333399"&gt;New-VM -VM $vmName -Name $cloneName -Datastore $ds -Location $Folder -VMHost $esx&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#333399"&gt;#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;# disconnect from vCenter&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333399"&gt;#!&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#333399"&gt;Disconnect-VIServer -Server $vcenter_server -Confirm:$false&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#333399"&gt;exit&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Sep 2023 15:11:20 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/How-do-I-exit-PowerCLI-on-an-error-in-a-script-running-in/m-p/2985725#M113143</guid>
      <dc:creator>stanj</dc:creator>
      <dc:date>2023-09-07T15:11:20Z</dc:date>
    </item>
    <item>
      <title>Re: How do I  exit PowerCLI on an error in a script running in Windows Scheduler</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/How-do-I-exit-PowerCLI-on-an-error-in-a-script-running-in/m-p/2985731#M113144</link>
      <description>&lt;P&gt;Do you mean the password for the account under which the task runs in the Windows Task Scheduler?&lt;BR /&gt;Or the password for the account with which you run the Connect-VIServer?&lt;BR /&gt;&lt;BR /&gt;To capture errors inside the script you can use Try-Catch construct.&lt;BR /&gt;If a cmdlet should fail with a non-terminating exception, you can always add an -ErrorAction Stop to force a terminating exception.&lt;BR /&gt;&lt;BR /&gt;When an exception occurs, you code will end up in the Catch block, where you could pass another exit code.&lt;BR /&gt;Which should also be reflected in the Task in the Windows Task Scheduler.&lt;BR /&gt;&lt;BR /&gt;For example, to capture a non-existing VM, you could do&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;Try {
   $esx = Get-Cluster -VM $vmName -ErrorAction Stop | Get-VMHost | Get-Random

   # The rest of your code

   exit 0  # All went well
}
Catch {
   exit 1  # Error encountered
}&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Sep 2023 15:22:32 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/How-do-I-exit-PowerCLI-on-an-error-in-a-script-running-in/m-p/2985731#M113144</guid>
      <dc:creator>LucD</dc:creator>
      <dc:date>2023-09-07T15:22:32Z</dc:date>
    </item>
    <item>
      <title>Re: How do I  exit PowerCLI on an error in a script running in Windows Scheduler</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/How-do-I-exit-PowerCLI-on-an-error-in-a-script-running-in/m-p/2985733#M113145</link>
      <description>&lt;P&gt;Thanks Luc&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I mean the username password for connecting to vcenter with&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;Connect-VIServer&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;When that happened, the connection failed and the cloning did not take place for that day and the names were off by a few days.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;So, i think the ..&lt;/SPAN&gt;&lt;SPAN&gt;Get-VM -Name $oldCloneName -ErrorAction SilentlyContinue | Remove-VM -DeletePermanently:$true -Confirm:$false failed&amp;nbsp;because the oldCloneName is based on a day that there was no cloning&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Let me add the block and see if it catches the issue.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Sep 2023 15:36:33 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/How-do-I-exit-PowerCLI-on-an-error-in-a-script-running-in/m-p/2985733#M113145</guid>
      <dc:creator>stanj</dc:creator>
      <dc:date>2023-09-07T15:36:33Z</dc:date>
    </item>
    <item>
      <title>Re: How do I  exit PowerCLI on an error in a script running in Windows Scheduler</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/How-do-I-exit-PowerCLI-on-an-error-in-a-script-running-in/m-p/2985741#M113147</link>
      <description>&lt;P&gt;You can also add the ErrorAction parameter on the Connect-VIServer cmdlet.&lt;BR /&gt;In the Catch block you find more information in the &lt;STRONG&gt;$error[0]&lt;/STRONG&gt; variable about the exception.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Sep 2023 15:49:00 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/How-do-I-exit-PowerCLI-on-an-error-in-a-script-running-in/m-p/2985741#M113147</guid>
      <dc:creator>LucD</dc:creator>
      <dc:date>2023-09-07T15:49:00Z</dc:date>
    </item>
    <item>
      <title>Re: How do I  exit PowerCLI on an error in a script running in Windows Scheduler</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/How-do-I-exit-PowerCLI-on-an-error-in-a-script-running-in/m-p/2986225#M113180</link>
      <description>&lt;P&gt;I have to drop back to the below code to ask a question before trying the error code,,,,&lt;/P&gt;&lt;P&gt;Question is at the bottom,.,&lt;/P&gt;&lt;P&gt;------------------------------------------------------&lt;/P&gt;&lt;P&gt;Set-PowerCLIConfiguration -Scope User -ParticipateInCEIP $false -Confirm:$false&lt;/P&gt;&lt;P&gt;Set-PowerCLIConfiguration -DisplayDeprecationWarning:$true&lt;/P&gt;&lt;P&gt;Connect-VIServer -Server $vcenter_server -User $user -Password $decryptedPassword&lt;/P&gt;&lt;P&gt;$ds = Get-Datastore | where{$_.Type -eq 'VMFS' -and $_.ExtensionData.Summary.MultipleHostAccess} |&lt;BR /&gt;Sort-Object -Property FreeSpaceGB -Descending | select -First 1&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;$esx = Get-Cluster -VM $vmName | Get-VMHost | Get-Random&lt;/P&gt;&lt;P&gt;#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!&lt;BR /&gt;# Set up cloning names - remove the day before&lt;BR /&gt;#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!&lt;/P&gt;&lt;P&gt;$cloneName = "$($vmName)-clone-$((Get-Date).ToString('MMddyyyy'))"&lt;BR /&gt;$oldCloneName = "$($vmName)-clone-$((Get-Date).AddDays(-1).ToString('MMddyyyy'))"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!&lt;BR /&gt;# Get the idm02 clone and remove the day before clone&lt;BR /&gt;#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Get-VM -Name $oldCloneName -ErrorAction SilentlyContinue |&lt;BR /&gt;Remove-VM -DeletePermanently:$true -Confirm:$false&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!&lt;BR /&gt;# Clone idm02 to curernt day&lt;BR /&gt;#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!&lt;BR /&gt;#&lt;/P&gt;&lt;P&gt;New-VM -VM $vmName -Name $cloneName -Datastore $ds -Location $Folder -VMHost $esx&lt;/P&gt;&lt;P&gt;#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!&lt;BR /&gt;# disconnect from vCenter&lt;BR /&gt;#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!&lt;BR /&gt;#!&lt;/P&gt;&lt;P&gt;Disconnect-VIServer -Server $vcenter_server -Confirm:$false&lt;/P&gt;&lt;P&gt;exit 0&lt;/P&gt;&lt;P&gt;------------------------------------------------------------------------&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I go to the Task Manager in Windows and right click on the task and select run to execute the above script,&amp;nbsp; I get a PowerShell window that pops up with the below and the window just stays up.&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I stop the&amp;nbsp;PowerShell window from opening when I right click and select "run"?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;FONT color="#3366FF"&gt;Scope ProxyPolicy DefaultVIServerMode InvalidCertificateAction DisplayDeprecationWarnings WebOperationTimeout&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#3366FF"&gt;Seconds&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#3366FF"&gt;----- ----------- ------------------- ------------------------ -------------------------- -------------------&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#3366FF"&gt;Session UseSystemProxy Single Ignore True 300&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#3366FF"&gt;User Single Ignore True&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#3366FF"&gt;AllUsers&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#3366FF"&gt;Perform operation?&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#3366FF"&gt;Performing operation 'Update PowerCLI configuration.'?&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#3366FF"&gt;[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"):&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Sep 2023 20:44:30 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/How-do-I-exit-PowerCLI-on-an-error-in-a-script-running-in/m-p/2986225#M113180</guid>
      <dc:creator>stanj</dc:creator>
      <dc:date>2023-09-11T20:44:30Z</dc:date>
    </item>
    <item>
      <title>Re: How do I  exit PowerCLI on an error in a script running in Windows Scheduler</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/How-do-I-exit-PowerCLI-on-an-error-in-a-script-running-in/m-p/2986241#M113182</link>
      <description>&lt;P&gt;What kind of file do you right-click on and select Run?&lt;BR /&gt;Is that a .ps1 file?&lt;BR /&gt;&lt;BR /&gt;When you start a script with &lt;A href="https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_powershell_exe?view=powershell-5.1" target="_blank" rel="noopener"&gt;powershell.exe&lt;/A&gt;, like you would do in Windows Task Scheduler, you add the &lt;STRONG&gt;-NonInteractive&lt;/STRONG&gt; parameter.&lt;BR /&gt;But you have to make sure that your script is not causing any interactive prompts.&lt;BR /&gt;Your 2nd Set-PowerCLIConfiguration does not contain the -Confirm:$false parameter, so there will be a prompt.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Sep 2023 21:31:41 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/How-do-I-exit-PowerCLI-on-an-error-in-a-script-running-in/m-p/2986241#M113182</guid>
      <dc:creator>LucD</dc:creator>
      <dc:date>2023-09-11T21:31:41Z</dc:date>
    </item>
    <item>
      <title>Re: How do I  exit PowerCLI on an error in a script running in Windows Scheduler</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/How-do-I-exit-PowerCLI-on-an-error-in-a-script-running-in/m-p/2986245#M113184</link>
      <description>&lt;P&gt;It is a .ps1 file&lt;/P&gt;&lt;P&gt;Where is the&amp;nbsp;&lt;STRONG&gt;-NonInteractive&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;parameter added ?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;In side the .ps1 script&amp;nbsp;or as a&amp;nbsp;parameter in the task job within&amp;nbsp;scheduler (below screen)?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="stanj_0-1694468549199.png" style="width: 400px;"&gt;&lt;img src="https://communities.vmware.com/t5/image/serverpage/image-id/103462iB39CCC55F6B45AD6/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="stanj_0-1694468549199.png" alt="stanj_0-1694468549199.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Sep 2023 21:42:46 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/How-do-I-exit-PowerCLI-on-an-error-in-a-script-running-in/m-p/2986245#M113184</guid>
      <dc:creator>stanj</dc:creator>
      <dc:date>2023-09-11T21:42:46Z</dc:date>
    </item>
    <item>
      <title>Re: How do I  exit PowerCLI on an error in a script running in Windows Scheduler</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/How-do-I-exit-PowerCLI-on-an-error-in-a-script-running-in/m-p/2986248#M113185</link>
      <description>&lt;P&gt;I added -NonInteractve below.&amp;nbsp; When I right click the task and select run, the Powershell screen flashes up and now I see a 0x1 in the Last Run Results in Task Scheduler&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="stanj_0-1694470553634.png" style="width: 400px;"&gt;&lt;img src="https://communities.vmware.com/t5/image/serverpage/image-id/103463iB78A4C8642106183/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="stanj_0-1694470553634.png" alt="stanj_0-1694470553634.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Sep 2023 22:18:39 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/How-do-I-exit-PowerCLI-on-an-error-in-a-script-running-in/m-p/2986248#M113185</guid>
      <dc:creator>stanj</dc:creator>
      <dc:date>2023-09-11T22:18:39Z</dc:date>
    </item>
    <item>
      <title>Re: How do I  exit PowerCLI on an error in a script running in Windows Scheduler</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/How-do-I-exit-PowerCLI-on-an-error-in-a-script-running-in/m-p/2986276#M113186</link>
      <description>&lt;P&gt;Exit code 1 means that an uncaught Throw happened (i.e. a terminating exception).&lt;BR /&gt;See&amp;nbsp;&lt;A href="https://devblogs.microsoft.com/powershell/windows-powershell-exit-codes/" target="_blank" rel="noopener"&gt;Windows PowerShell Exit Codes&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;With the Try-Catch I mentioned earlier you can use different exit codes in the Catch block to clarify what went wrong.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2023 06:15:10 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/How-do-I-exit-PowerCLI-on-an-error-in-a-script-running-in/m-p/2986276#M113186</guid>
      <dc:creator>LucD</dc:creator>
      <dc:date>2023-09-12T06:15:10Z</dc:date>
    </item>
  </channel>
</rss>

