Utils.psm1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
function Invoke-Cmd { param( # Command [Parameter(Mandatory = $true)] [string] $Command ) $ErrorActionPreference = 'stop' $result = Invoke-Expression "& $Command" if ($LASTEXITCODE -ne 0) { Write-Error -Message $result } return $result } |