Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

$Bitness = (Get-wmiobject win32_operatingsystem).OSarchitecture

is better to use.

Environment Variables

 

Pipeline

Most of Powershell's commands have an output which can be transferred directly to another command. Below is a simple example.

Get-Process | Out-Gridview

Using the pipeline can produce several different results, but allow you to customize the output according to your needs.

Get-Process | sort -Property Name,ID | export-csv -Path "$env:userprofile\Desktop\processes.csv"

The above line grabs all processes, sorts them by Name then ID and finally exports them to the Desktop as a csv file. The "$env:userprofile" is an environment variable. View Environment Variables to learn more.