question

tmunro55-1427 avatar image
0 Votes"
tmunro55-1427 asked tmunro55-1427 answered

Abort Granfeldt PSMA script and pass status back to MIM.

Hello,

I have a situation where I need to abort a Granfeldt PSMA script in the BEGIN block. What I can’t figure out is what MIM is expecting back so I can show a result of failed. Following is the snippet of code I'm talking about.


 $Configuration = "C:\MIMPowerShellResources\Environment.json"
 if(test-Path $Configuration) {
     $Config = Get-Content $Configuration | ConvertFrom-JSON
     $Running_Environment = $Config.Running_Environment
     $data_source = $Config.Data_Source.$Running_Environment
 } else {
     $retObj = @{}
     $retobj."[ErrorName]" = 'failed'
     $retobj."[ErrorDetail]" = 'Config file missing'
     $retobj
     Break
 }

I need to abort the script and pass back a status of "failed". I'm always getting "success".

Any help would be greatly appreciated.

microsoft-identity-manager
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

SteinIP avatar image
1 Vote"
SteinIP answered

I think you need to throw an error to abort. That can be fancy using an appropriate exception or simple:
throw "Config file missing"



5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

tmunro55-1427 avatar image
0 Votes"
tmunro55-1427 answered

Thank you. Sounds easy enough.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.