我正在编写一个powershell脚本:
我遇到了一个问题,我正在使用MDM同时在许多机器上自动部署MDM。来自MDM的反馈显示,安装失败--但安装的文件确实正常工作。因此,MDM很可能会收到糟糕的返回值。MDM出口代码如下所示
那么:如何确保powershell脚本在3之后返回成功。如果hashsum是正确的,它会安装它,=0会使它工作吗?
发布于 2022-01-24 14:08:18
只需使用exit和您想要的退出代码。比如:
Function CustomExit{
Write-Output "This function returns exit code 1613"
Exit 1613 # Custom Exit Code
}
CustomExit要进行测试,只需运行该文件并发出退出代码
PS C:\script> .\CustomExitCode.ps1
This function returns exit code 1613
PS C:\script> $LASTEXITCODE
1613
PS C:\script>https://stackoverflow.com/questions/70832909
复制相似问题