like this actually
This commit is contained in:
parent
e3c75c5d2a
commit
32cde1eba1
|
@ -41,10 +41,10 @@ function prompt {
|
|||
$prompt = "> "
|
||||
If ((New-Object Security.Principal.WindowsPrincipal $(
|
||||
[Security.Principal.WindowsIdentity]::GetCurrent()
|
||||
).IsInRole(
|
||||
[Security.Principal.WindowsBuiltinRole]::Administrator
|
||||
)
|
||||
)) {
|
||||
)).IsInRole(
|
||||
[Security.Principal.WindowsBuiltinRole]::Administrator
|
||||
)
|
||||
) {
|
||||
$prompt = "Admin$prompt"
|
||||
}
|
||||
$prompt
|
||||
|
|
|
@ -5,10 +5,10 @@ function prompt {
|
|||
$prompt = "> "
|
||||
If ((New-Object Security.Principal.WindowsPrincipal $(
|
||||
[Security.Principal.WindowsIdentity]::GetCurrent()
|
||||
).IsInRole(
|
||||
[Security.Principal.WindowsBuiltinRole]::Administrator
|
||||
)
|
||||
)) {
|
||||
)).IsInRole(
|
||||
[Security.Principal.WindowsBuiltinRole]::Administrator
|
||||
)
|
||||
) {
|
||||
$prompt = "Admin$prompt"
|
||||
}
|
||||
$prompt
|
||||
|
|
|
@ -2,10 +2,10 @@ param([switch]$elevated)
|
|||
# If not in an Administrator environment
|
||||
If (!(New-Object Security.Principal.WindowsPrincipal $(
|
||||
[Security.Principal.WindowsIdentity]::GetCurrent()
|
||||
).IsInRole(
|
||||
[Security.Principal.WindowsBuiltinRole]::Administrator
|
||||
)
|
||||
)) {
|
||||
)).IsInRole(
|
||||
[Security.Principal.WindowsBuiltinRole]::Administrator
|
||||
)
|
||||
) {
|
||||
# and elevating hasn't already been tried
|
||||
if (!$elevated) {
|
||||
# attmempt to become Administrator by re-invoking this script
|
||||
|
|
Loading…
Reference in a new issue