$exitCode = $LastExitCode switch ($exitCode) { 0 { Write-Host "退出代码为0,表示成功" # 执行其他操作 } 1 { Write-Host "退出代码为1,表示失败" # 执行其他操作 } default { Write-Host "未知的退出代码" } } 获取上一个命令的退出代码: 代码语言:txt 复制 $exitCode = $LastExitCode Write...
-ForegroundColor "White" Start-Sleep -Seconds 5 Exit } #If the error code is 3010, the SCCM 2012 Admin console successfully installed, but the system requires a restart Elseif ($Inst_DotNet4.ExitCode -eq "3010") { Write-Host "The .Net Framework 4 installation completed sucessfully!" -Fo...
Visual Studio Code 效能考量 開發新式模組 PowerShell 語言規格 3.0 1. 簡介 2. 語彙結構 3. 基本概念 4. 類型 5. 變數 6. 轉換 7. 運算式 8. 語句 9. 陣列 10. 哈希表 11. 模組 12. 屬性 13. Cmdlet A. 以批注為基礎的說明 B. 文法 ...
3010 { DS_WriteLog "W" "A reboot is required (exit code: 3010)!" $LogFile } default { [string]$ExitCode = $Process.ExitCode DS_WriteLog "E" "The $Result2 ended in an error (exit code: $ExitCode)!" $LogFile Exit 1 } } } end { DS_WriteLog "I" "END FUNCTION - $Functio...
Allows the 3010 return code (requires restart) to be passed back to the parent process (e.g. SCCM) if detected from an installation. If 3010 is passed back to SCCM, a reboot prompt will be triggered. .PARAMETER TerminalServerMode
另一种编写代码的方法是在if之外运行jfrog,然后检查$LASTEXITCODE的结果:
When setup exits with an exit code other than 0 or 3010 a warning message is written to console telling that setup finished with an error (partly fixes issue 580). Added a new parameter SetupProcessTimeout which defaults to 7200 seconds (2 hours). If the setup process has not finished be...
“Script”: “$me[0].Program=3010”, “Caption”: “Auto Transition”, “Description”: “Cut 7” }, { “Mode”: “Script”, “KeyID”: 45, “Command”: ”“, “Script”: “$me[0].Program=3020”, “Caption”: “Auto Transition”, ...
如果前一个cmdlet出现任何错误,则$?返回$false。对于 * 外部命令 *,将返回$LASTEXITCODE -eq 0的...
La syntaxe suivante est simplifiée à partir du code MOF (Managed Object Format) et inclut toutes les propriétés héritées.SyntaxeMOF Copier Class SMS_TaskSequence_RunPowerShellScriptAction : SMS_TaskSequence_Action { SMS_TaskSequence_Condition Condition; Boolean ContinueOnError; Stri...