like this actually

This commit is contained in:
talon 2023-06-17 18:37:01 -06:00
parent e3c75c5d2a
commit 32cde1eba1
3 changed files with 12 additions and 12 deletions

View file

@ -41,10 +41,10 @@ function prompt {
$prompt = "> " $prompt = "> "
If ((New-Object Security.Principal.WindowsPrincipal $( If ((New-Object Security.Principal.WindowsPrincipal $(
[Security.Principal.WindowsIdentity]::GetCurrent() [Security.Principal.WindowsIdentity]::GetCurrent()
).IsInRole( )).IsInRole(
[Security.Principal.WindowsBuiltinRole]::Administrator [Security.Principal.WindowsBuiltinRole]::Administrator
) )
)) { ) {
$prompt = "Admin$prompt" $prompt = "Admin$prompt"
} }
$prompt $prompt

View file

@ -5,10 +5,10 @@ function prompt {
$prompt = "> " $prompt = "> "
If ((New-Object Security.Principal.WindowsPrincipal $( If ((New-Object Security.Principal.WindowsPrincipal $(
[Security.Principal.WindowsIdentity]::GetCurrent() [Security.Principal.WindowsIdentity]::GetCurrent()
).IsInRole( )).IsInRole(
[Security.Principal.WindowsBuiltinRole]::Administrator [Security.Principal.WindowsBuiltinRole]::Administrator
) )
)) { ) {
$prompt = "Admin$prompt" $prompt = "Admin$prompt"
} }
$prompt $prompt

View file

@ -2,10 +2,10 @@ param([switch]$elevated)
# If not in an Administrator environment # If not in an Administrator environment
If (!(New-Object Security.Principal.WindowsPrincipal $( If (!(New-Object Security.Principal.WindowsPrincipal $(
[Security.Principal.WindowsIdentity]::GetCurrent() [Security.Principal.WindowsIdentity]::GetCurrent()
).IsInRole( )).IsInRole(
[Security.Principal.WindowsBuiltinRole]::Administrator [Security.Principal.WindowsBuiltinRole]::Administrator
) )
)) { ) {
# and elevating hasn't already been tried # and elevating hasn't already been tried
if (!$elevated) { if (!$elevated) {
# attmempt to become Administrator by re-invoking this script # attmempt to become Administrator by re-invoking this script