Split text by columns in PowerShell

后端 未结 12 2115
猫巷女王i
猫巷女王i 2020-11-28 15:37

I\'m a PowerShell novice (Bash is my thing normally) who\'s currently trying to obtain qwinsta output to show who is logged in as an \'rdpwd\' (rdesktop) user so that I can

12条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-28 16:14

    How about using running processes to look for explorer instances for the logged-in users? (Or some other process you know your users to be running):

    Get-WmiObject -ComputerName "Machine" -Class win32_process | Where-Object {$_.Name -match "explorer"} | ForEach-Object {($_.GetOwner()).User}
    

    Will provide all usernames associated with running explorer processes.

提交回复
热议问题