Important Notice: On February 29th, this community was put into read-only mode. All existing posts will remain but customers are unable to add new posts or comment on existing. Please feel to join our Community Discord for any questions and discussions.

Output that Powershell script has failed

Hi there,

I've created a PDQ package to update the BIOS password on our computers. It works perfectly, except it will say it's successful even if it's failed due to the current password not matching the one in the script. Is there a way to get it to report failed?

This is the output for success:

__GENUS          : 2
__CLASS          : __PARAMETERS
__SUPERCLASS     : 
__DYNASTY        : __PARAMETERS
__RELPATH        : 
__PROPERTY_COUNT : 1
__DERIVATION     : {}
__SERVER         : 
__NAMESPACE      : 
__PATH           : 
Return           : 0
PSComputerName   : 

 

And for failure:

__GENUS          : 2
__CLASS          : __PARAMETERS
__SUPERCLASS     : 
__DYNASTY        : __PARAMETERS
__RELPATH        : 
__PROPERTY_COUNT : 1
__DERIVATION     : {}
__SERVER         : 
__NAMESPACE      : 
__PATH           : 
Return           : 6
PSComputerName   : 

But PDQ just says "Return code: 0" and "Successful" for both.

Thanks,

Tim

 

0

Comments

1 comment
Date Votes
  • You'll have to capture that output in a variable, then do something like this:

    exit $BiosPasswordOutput.Return
    0