QuserObject
Run quser.exe
and return a proper PowerShell Object.
I discussed this on my blog to enhance a StackOverflow answer.
I ended up making this into a module: QuserObject.
The source is on GitHub.
Quick Setup
- Install QuserObject:
Install-Module QuserObject
. - Import QuserObject:
Import-Module QuserObject
. - Start QuserObject:
Get-Quser
.
Examples
Quick Example
This will return the quser.exe
results for the current computer (aka localhost
).
Get-QuserObject
Target a Server
This will return the quser.exe
results for ThisServer
.
Get-QuserObject -ServerName 'ThisServer'
Target Multiple Servers
This will return the quser.exe
results for ThisServer
and ThatServer
.
Get-QuserObject -ServerName 'ThisServer', 'ThatServer'
Pipeline Multiple Servers
This will return the quser.exe
results for ThisServer
and ThatServer
.
@('ThisServer', 'ThatServer') | Get-QuserObject
AD Computer
This will return the quser.exe
results for ThisServer
.
The value is piped from a Get-ADComputer
query.
Get-ADComputer 'ThisServer' | Get-QuserObject
AD Computer with Different Property
This will return the quser.exe
results for ThisServer
.
This value is piped from a Get-ADComputer
query and using the AD computer DNSHostName
property instead of the default Name
property.
Get-ADComputer 'ThisServer' | Get-QuserObject -Property 'DNSHostName'