PS7 fixes
This commit is contained in:
27
Elysium.ps1
27
Elysium.ps1
@@ -74,6 +74,20 @@ function Start-OrchestratorTranscript {
|
|||||||
|
|
||||||
function Stop-OrchestratorTranscript { try { Stop-Transcript | Out-Null } catch {} }
|
function Stop-OrchestratorTranscript { try { Stop-Transcript | Out-Null } catch {} }
|
||||||
|
|
||||||
|
function Invoke-WindowsPowerShellScript {
|
||||||
|
param([string]$ScriptPath)
|
||||||
|
$powershellCmd = Get-Command -Name 'powershell.exe' -ErrorAction SilentlyContinue
|
||||||
|
if (-not $powershellCmd) {
|
||||||
|
throw "Windows PowerShell (powershell.exe) was not found. Install it or run the script from a Desktop edition session."
|
||||||
|
}
|
||||||
|
$args = @('-NoLogo', '-NoProfile', '-ExecutionPolicy', 'Bypass', '-File', $ScriptPath)
|
||||||
|
& $powershellCmd.Path @args
|
||||||
|
$exitCode = $LASTEXITCODE
|
||||||
|
if ($exitCode -ne 0) {
|
||||||
|
throw ("Windows PowerShell script '{0}' exited with code {1}." -f $ScriptPath, $exitCode)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function Show-Menu {
|
function Show-Menu {
|
||||||
param (
|
param (
|
||||||
[string]$Title = 'Elysium Tool Main Menu'
|
[string]$Title = 'Elysium Tool Main Menu'
|
||||||
@@ -138,16 +152,3 @@ do {
|
|||||||
} finally {
|
} finally {
|
||||||
Stop-OrchestratorTranscript
|
Stop-OrchestratorTranscript
|
||||||
}
|
}
|
||||||
function Invoke-WindowsPowerShellScript {
|
|
||||||
param([string]$ScriptPath)
|
|
||||||
$powershellCmd = Get-Command -Name 'powershell.exe' -ErrorAction SilentlyContinue
|
|
||||||
if (-not $powershellCmd) {
|
|
||||||
throw "Windows PowerShell (powershell.exe) was not found. Install it or run the script from a Desktop edition session."
|
|
||||||
}
|
|
||||||
$args = @('-NoLogo', '-NoProfile', '-ExecutionPolicy', 'Bypass', '-File', $ScriptPath)
|
|
||||||
& $powershellCmd.Path @args
|
|
||||||
$exitCode = $LASTEXITCODE
|
|
||||||
if ($exitCode -ne 0) {
|
|
||||||
throw ("Windows PowerShell script '{0}' exited with code {1}." -f $ScriptPath, $exitCode)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user