Im having an issue with a regular expression im trying to figure out.
I need to get the last word at the end of an output from a cmd line tool, which I have made a PowerShell wrapper for.
Since I need to check if the output is “Enabled”, “Disabled”, “True”, “False”, “0” or “1”, I need to only get the last line/word from that output.
I am able to retrieve it using the following code:
$Request = & $AppPath -r $iDRACIp.IPAddressToString -u $Credential.GetNetworkCredential().UserName -p $Credential.GetNetworkCredential().Password "\""$Command\""" --nocertwarn
# Get command output value $Output = Select-String -InputObject $Request -Pattern "[^=]+$" $Results = $Output.Matches.Value Return $Results</pre>