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;
|
using namespace System.Security.Principal;
|
||||||
|
|
||||||
enum SetupStage {
|
enum SetupStage {
|
||||||
Initialize = "init"
|
Initialize
|
||||||
Install = "install"
|
Install
|
||||||
}
|
}
|
||||||
|
|
||||||
$null = New-Module {
|
$null = New-Module {
|
||||||
|
@ -88,7 +88,7 @@ $null = New-Module {
|
||||||
Gets the name of the current setup stage.
|
Gets the name of the current setup stage.
|
||||||
#>
|
#>
|
||||||
function Get-Stage {
|
function Get-Stage {
|
||||||
return Get-SetupOption $stageOption;
|
return [SetupStage](Get-SetupOption $stageOption);
|
||||||
}
|
}
|
||||||
|
|
||||||
<#
|
<#
|
||||||
|
@ -100,9 +100,13 @@ $null = New-Module {
|
||||||
#>
|
#>
|
||||||
function Set-Stage {
|
function Set-Stage {
|
||||||
param(
|
param(
|
||||||
[string] $Name
|
$Name
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (-not ($Name -is [string])) {
|
||||||
|
$Name = ([SetupStage]$Name).ToString();
|
||||||
|
}
|
||||||
|
|
||||||
$null = Set-SetupOption $stageOption $Name;
|
$null = Set-SetupOption $stageOption $Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,4 +127,13 @@ $null = New-Module {
|
||||||
$Value
|
$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