$Step1Complete = $null $SCTaskNum = '' try { $FQDN = 'itdcndhh22ywt.nd.gov' $CIDR = '10.221.10.96/28' New-ITDIbDNSRecordNextAvailableIP -Hostname $FQDN -CIDR $CIDR -Credential $RadiusCred Write-Verbose -Message "New-ITDWindowsVmVMwareStep1 function completed" $Step1Complete = $true } catch { #Write-Error -Message $error[0] $Step1Complete = $false $ErrorText = ($_.ErrorDetails.message | ConvertFrom-Json).text If ($ErrorText -match "Cannot find 1 available IP address" ) { $Msg = "Resolve the issue and resubmit the Server Build Request catalog item. Setting $SCTaskNum State to Closed Incomplete" Write-Warning -Message $Msg Update-ITDServiceNowRecord -ItemType 'Catalog Task' -Number $SCTaskNum -Values @{ #> work_notes = ("VMware build step 1 errored. $Msg. `nPSU Job Id #" + '52928' + " `n" + $ErrorText) state = 'Closed Incomplete' close_notes = ("VMware build step 1 errored. $Msg. `nPSU Job Id #" + '52928' + " `n" + $ErrorText) } } throw }