Store stages using their name
This commit is contained in:
parent
467ad0caab
commit
9a3c5f6b32
|
@ -3,8 +3,8 @@ using namespace System.Security.AccessControl;
|
|||
using namespace System.Security.Principal;
|
||||
|
||||
enum SetupStage {
|
||||
Initialize = "init"
|
||||
Install = "install"
|
||||
Initialize
|
||||
Install
|
||||
}
|
||||
|
||||
$null = New-Module {
|
||||
|
@ -88,7 +88,7 @@ $null = New-Module {
|
|||
Gets the name of the current setup stage.
|
||||
#>
|
||||
function Get-Stage {
|
||||
return Get-SetupOption $stageOption;
|
||||
return [SetupStage](Get-SetupOption $stageOption);
|
||||
}
|
||||
|
||||
<#
|
||||
|
@ -100,9 +100,13 @@ $null = New-Module {
|
|||
#>
|
||||
function Set-Stage {
|
||||
param(
|
||||
[string] $Name
|
||||
$Name
|
||||
)
|
||||
|
||||
if (-not ($Name -is [string])) {
|
||||
$Name = ([SetupStage]$Name).ToString();
|
||||
}
|
||||
|
||||
$null = Set-SetupOption $stageOption $Name;
|
||||
}
|
||||
|
||||
|
@ -123,4 +127,13 @@ $null = New-Module {
|
|||
$Value
|
||||
)
|
||||
}
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Checks whether the active session is executed with admin rights.
|
||||
#>
|
||||
function Test-Admin {
|
||||
net session 2> $null | Out-Null;
|
||||
return $?;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue