Make username all lower case in PowerShell prompt
This commit is contained in:
parent
209010e90e
commit
44098ee021
@ -36,10 +36,11 @@ function Prompt {
|
||||
$identity = [Security.Principal.WindowsIdentity]::GetCurrent()
|
||||
$principal = [Security.Principal.WindowsPrincipal] $identity
|
||||
$adminRole = [Security.Principal.WindowsBuiltInRole]::Administrator
|
||||
$userName = $Env:USERNAME.ToLower()
|
||||
if($principal.IsInRole($adminRole)) {
|
||||
$Env:USERNAME | Write-Host -ForegroundColor DarkRed -NoNewline
|
||||
$userName | Write-Host -ForegroundColor DarkRed -NoNewline
|
||||
} else {
|
||||
$Env:USERNAME | Write-Host -ForegroundColor DarkGreen -NoNewline
|
||||
$userName | Write-Host -ForegroundColor DarkGreen -NoNewline
|
||||
}
|
||||
return ' '
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user