Move UAC handling to context
This commit is contained in:
parent
98dfa910be
commit
0996dbecaf
2 changed files with 15 additions and 18 deletions
scripts/Windows/Scripts
|
@ -148,6 +148,11 @@ class Context {
|
|||
$action.Invoke($key);
|
||||
}
|
||||
|
||||
[Microsoft.Win32.RegistryKey] GetSystemPolicyKey() {
|
||||
$keyPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System";
|
||||
return Get-Item "$keyPath";
|
||||
}
|
||||
|
||||
[Microsoft.Win32.RegistryKey] GetRunOnceKey() {
|
||||
return $this.GetRunOnceKey($null);
|
||||
}
|
||||
|
@ -169,6 +174,14 @@ class Context {
|
|||
return $result;
|
||||
}
|
||||
|
||||
[bool] GetUACState() {
|
||||
return [bool](Get-ItemPropertyValue -Path ($this.GetSystemPolicyKey().PSPath) -Name "EnableLUA");
|
||||
}
|
||||
|
||||
[void] SetUACState([bool] $value) {
|
||||
$null = Set-ItemProperty -Path ($this.GetSystemPolicyKey().PSPath) -Name "EnableLUA" -Value [int]$value;
|
||||
}
|
||||
|
||||
[void] RegisterReboot() {
|
||||
$this.RegisterReboot($null);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue