All Help topics inside of PowerShell are stored as plain text files. You can read them by using Get-Help, but you can also more easily open the...
Powershell
Dangerous Keystroke
You are probably aware of CTRL+C to break the current command. However, you should beware of CTRL+BREAK! This key shortcut will not only break the...
Getting Advanced Help
While Get-Help does not just document cmdlets, it also allows you to find out more about general PowerShell concepts: Get-Help about_* For example,...
Getting Paginated Help
Reading Help information using Get-Help is great, but often (especially when specifying the -full or -detailed switch parameter), you retrieve so...
Childproofing PowerShell
If you are new to PowerShell, you may be worried about causing unwanted damage or change. One way of childproofing PowerShell is by changing the...
Find Potentially Harmful Cmdlets
Any cmdlet that can change and potentially damage your system supports the -whatif parameter, allowing you to just simulate the action without...
Use the Force!
Many cmdlets support the -force switch parameter. With it, the cmdlet will do more than usual. What exactly -force does depends on the cmdlet. For...
Listing Program Versions
You may already know about the Get-Process cmdlet, which lists all running processes, locally and remotely (use -computername for remote access)....
Using Relative Dates
Sometimes, you need relative dates. What date was 14 days ago? Maybe you want to use this relative date to select files of a certain age. You can...
Creating Temporary File Names
Get-Date not only will retrieve the current date, but you can also construct a custom date format to create time-stamped temporary file names:...
Getting Hotfix Information
PowerShell v.2 comes with a new cmdlet called Get-Hotfix. It retrieves for you all installed hotfixes and updates. You can use it locally or...
Validating Input Type
The -as parameter is not widely known but is extremely versatile. It tries to convert data into a .NET type, and when it fails, it simply returns...
Speeding Up Remote Inventory
Get-WMIObject is a fantastic cmdlet to query information locally and on remote systems. Have a look: Get-Content c:\management.txt |ForEach-Object {...
Enabling Block Cursor
How would you like to get back the big ugly block cursor you may know from Commodore 64-systems? Here is a way: $Host.UI.RawUI.CursorSize = 100...
Resolve Host Names
Have you ever needed to resolve a host name to find its IP address? Simply use a .NET method and wrap it as PowerShell function: function...
Creating "Constant" Functions
When you make a function read-only, it can no longer be overwritten but you would still be able to delete the function and recreate it from scratch....
Adding Write Protection to functions
Functions by default have no write protection so they can easily be overwritten and redefined. You should do this if you'd like to make a...
Converting Database Records into PowerShell objects
When you access a database, the result is not automatically wrapped as objects so you cannot pipe the result into other cmdlets like Sort-Object or...
Opening Databases from PowerShell
The easiest way of accessing databases right from PowerShell is to visit control panel and open the Data Sources (ODBC) module (which resides in...
Get Process Owners
One way to find out the owner of a process is to add the missing Owner property to process objects: $processes = Get-WmiObject Win32_Process -Filter...
Change Service Account Password
Ever wanted to automatically change the Password a service uses to log on to its account? WMI has a solution. Have a look: $localaccount =...
Adding a Hash property to file objects
You can easily add new properties and functions to object types using the extended type system. In this example, you append file objects with a new...
Adding File Age to file objects
PowerShell cmdlets return objects with rich information, and to see all the information, you can pipe the result to Format-List *: Dir $env:windir |...
Using Calculated Columns in New Objects
Select-Object can add new properties to objects and fill them with calculated content. All you need for this is a hash table with two pieces of...