Add a 'who' function for Windows

This commit is contained in:
Anthony Rose 2023-10-03 08:55:07 +01:00
parent 693c778cf5
commit e2db055204

View file

@ -54,7 +54,7 @@ function ADUserInfo {
Get-ADUser -Properties $ADPropertiesGet -Identity $User | Select-Object -Property $ADPropertiesPrint Get-ADUser -Properties $ADPropertiesGet -Identity $User | Select-Object -Property $ADPropertiesPrint
} }
Function mkcd { function mkcd {
param ( param (
[Parameter(Mandatory)] [Parameter(Mandatory)]
[string]$Path [string]$Path
@ -63,6 +63,12 @@ Function mkcd {
Set-Location -Path $Path Set-Location -Path $Path
} }
if ($IsWindows -or ($env:OS -eq "Windows_NT")) {
function who {
& "$env:SystemRoot\System32\query.exe" user
}
}
Set-PSReadlineOption -BellStyle None Set-PSReadlineOption -BellStyle None
Set-PSReadlineOption -EditMode Emacs Set-PSReadlineOption -EditMode Emacs
Set-PSReadlineKeyHandler -Key Tab -Function Complete Set-PSReadlineKeyHandler -Key Tab -Function Complete