Below are some simple PowerShell scripts that I find pretty useful in Windows administration:

Note: For the scripts that connect to a remote machine, you will need to run PowerShell as a user with Administrator privileges to that machine.

Aliases:

  • Gwmi = Get-WmiObject
  • fl = Format-List
  • ft = Fomat-Table
  • -Comp = -ComputerName

Get a list of installed applications for a specified machine (32-bit OS only).
Gwmi Win32_Product -Comp computer_name | Sort name | ft name, version, installdate

Get the Service Tag (Dell computers) and BIOS version for a specified machine.
Gwmi Win32_BIOS -Comp computer_name

Get the computer information for a specified machine (Domain, Manufacturer, Model, Name, Owner, Memory).
Gwmi Win32_ComputerSystem -Comp computer_name | fl

Get storage drive information for a specified machine (Hard Drive, Floppy, CD/DVD-ROM).
Gwmi Win32_LogicalDisk -Comp computer_name | fl

Get the logged on user name for a specified machine.
Gwmi Win32_Computersystem -Comp computer_name | Select Name, UserName

Get the running processes for a specified machine.
Gwmi Win32_Process -ComputerName computer_name | Sort processname | ft processname, ws, executablepath