私は非常に奇妙なパワーシェルの動作をしています。If、elseif、else があります。If は機能し、else if は機能しますが、else は発生しませんでした。
どうなり得るか?
これはスクリプトです:
$result = Get-AMTHardwareAsset $Computer -credential $VProCredential -textoutput
if ($result.Contains("Unauthorized") -eq $true)
{
Add-Results "$Computer`tHardwareAssets-Unauthorized"
}
elseif ($result.Contains("Could not connect") -eq $true)
{
Add-Results "$Computer`tHardwareAssets-CannotConect"
}
else
{
Add-Results "TESTING"
}