From e2db055204e2775c7691a970e0a04139cd13b3ff Mon Sep 17 00:00:00 2001 From: Anthony Perkins Date: Tue, 3 Oct 2023 08:55:07 +0100 Subject: [PATCH] Add a 'who' function for Windows --- roles/home-cli/files/Microsoft.PowerShell_profile.ps1 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/roles/home-cli/files/Microsoft.PowerShell_profile.ps1 b/roles/home-cli/files/Microsoft.PowerShell_profile.ps1 index f7a95a3..91a82ca 100644 --- a/roles/home-cli/files/Microsoft.PowerShell_profile.ps1 +++ b/roles/home-cli/files/Microsoft.PowerShell_profile.ps1 @@ -54,7 +54,7 @@ function ADUserInfo { Get-ADUser -Properties $ADPropertiesGet -Identity $User | Select-Object -Property $ADPropertiesPrint } -Function mkcd { +function mkcd { param ( [Parameter(Mandatory)] [string]$Path @@ -63,6 +63,12 @@ Function mkcd { 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 -EditMode Emacs Set-PSReadlineKeyHandler -Key Tab -Function Complete