Powershell

Discovering Impact Level

In a previous tip, you learned how to use $ConfirmPreference to get a warning before a cmdlet actually changes your system. This was based on the...

read more

Hide Error Messages

You may already know that you can suppress error messages with the ErrorAction parameter, which is often a good idea. Take a look at this and then...

read more

Temporary File Name

Thanks to Get-Date, you can easily create unique temporary file names with a timestamp: (Get-Date -format 'yyyy-MM-dd hh-mm-ss') +...

read more

Stopping the Pipeline

Usually, once a pipeline runs, you cannot stop it prematurely, even if you already received the information you were seeking. Simply use this filter...

read more

Creating Large Dummy Files

Sometimes, it is more efficient to use existing console tools rather than PowerShell cmdlets. For example here is a way to create a large file for...

read more

Accessing Profile Scripts

Profile scripts are executed automatically when PowerShell starts. The paths to these scripts can be found in $profile: $profile | gm *Host* | % {...

read more

Listing Execution Policies

In PowerShell v.2, there are multiple execution policies. You should use this to view and check the settings: Get-ExecutionPolicy -List ReTweet this...

read more

Wait for Programs

PowerShell launches Windows applications asynchronously. It only waits for the console application so you should use -wait if you want to launch a...

read more

Use Online Help

"To ship is to choose", so the Help files provided by PowerShell are sometimes outdated. You should use their online versions if you want...

read more

Get to know Parameter Sets

Sometimes, you may run into issues like this once you learned more about the parameters a given cmdlet supports: Get-Random -Minimum 1 -Maximum 50...

read more