like this actually
This commit is contained in:
parent
e3c75c5d2a
commit
32cde1eba1
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue