You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2.4 KiB

PS Commands

Note: unless otherwise stated, replace any variable such as $ComputerName with the appropriate data.


Computers


Remotely Fetch a Computer's UUID

(Get-CimInstance -Class Win32_ComputerSystemProduct -ComputerName $ComputerName).UUID

Remotely Fetch a (Partial) Installed Program List for $ComputerName

Get-WmiObject win32_product -ComputerName $ComputerName | Sort-Object | select Vendor, Name, version

Remotely Fetch Installed Programs from $ComputerName by searching $Column (Vendor, Name, or version) for $SearchTerm

Get-WmiObject win32_product -ComputerName $ComputerName | Where-Object {$_.$Column -like *$SearchTerm*} | Sort-Object | select Vendor, Name, version

Remotely Fetch $ComputerName's Windows Version Information

Invoke-Command -ComputerName $ComputerName -ScriptBlock {[System.Environment]::OSVersion.Version}

Remotely Fetch $ComputerName's Boot Time

Get-CimInstance -ClassName Win32_OperatingSystem -ComputerName $ComputerName | select csname, lastbootuptime

Fetch $ComputerName's Group Membership

Get-ADPrincipalGroupMembership (Get-ADComputer $ComputerName) | select-object name

Remotely Fetch $ComputerName's Make & Model

Get-CimInstance -ComputerName $ComputerName -ClassName Win32_ComputerSystem | Select-Object -Property Manufacturer, Model

Remotely Fetch $ComputerName's Serial Number

Get-CimInstance -ComputerName $ComputerName -ClassName Win32_bios | Select-Object -Property SerialNumber

Remotely Fetch $ComputerName's Total/Free Storage

Get-WmiObject Win32_LogicalDisk -ComputerName $ComputerName -Filter DriveType=3 | Select-Object DeviceID, @{'Name'='Size (GB)'; 'Expression'={[math]::truncate($_.size / 1GB)}}, @{'Name'='Freespace (GB)'; 'Expression'={[math]::truncate($_.freespace / 1GB)}}

Remotely Fetch $ComputerName's BIOS Version

Get-WmiObject -Class Win32_BIOS -ComputerName $ComputerName

Users


Fetch $Username's Group Membership

Get-ADPrincipalGroupMembership (Get-ADUser $Username) | select-object name

Groups


Fetch AD Groups with $SearchTerm in them

Get-ADGroup -Filter 'name -like "*$SearchTerm*"' | Sort-Object | select Name