Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Running powershell script as custom Activity

AsheeshG
Tera Contributor

Hi,

I am using a PowerShell custom activity that creates ad group . I have some validations which throw error back.

Example 

if (@($AccountOwnerObject).count -gt 1) {
Throw "FAIL: Multiple accounts found for CA Account Owner $PrivilegedAccountOwner"
}

So when this is executed my output is Null. When i use 

if (@($AccountOwnerObject).count -gt 1) {
Write-Host "FAIL: Multiple accounts found for CA Account Owner $PrivilegedAccountOwner"

return
}

I get the output. 

The script is running on MID server.

Let me know where i am going wrong.

I am on Washington DC.

 

Thanks in advance.

 

0 REPLIES 0