diff --git a/scripts/Windows/Scripts/Security.ps1 b/scripts/Windows/Scripts/Security.ps1 new file mode 100644 index 00000000..c23c7f0c --- /dev/null +++ b/scripts/Windows/Scripts/Security.ps1 @@ -0,0 +1,36 @@ +$null = New-Module { + $uacOption = "EnableLUA"; + $systemPolicyPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System"; + + $uacSetter = { + param( + [bool] $Value + ) + + Set-ItemProperty -Path $systemPolicyPath -Name $uacOption -Value ([int]$Value); + } + + <# + .SYNOPSIS + Determines whether UAC is enabled. + #> + function Get-UACStatus { + [bool](Get-ItemProperty -Path $systemPolicyPath -Name $uacOption); + } + + <# + .SYNOPSIS + Enables UAC. + #> + function Enable-UAC { + & $uacSetter $true; + } + + <# + .SYNOPSIS + Disables UAC. + #> + function Disable-UAC { + & $uacSetter $false; + } +}; \ No newline at end of file