Debug, Parameter

PowerShell Debug Parameter

This article is eagerly awaiting to be written (honestly)!
Continue reading →

Verbose, Parameter

PowerShell Verbose Parameter

Some cmdlets can provide verbose data. This is disabled by default but can be enabled by using the -Verbose parameter. This can be useful if you want to log an action or troubleshoot your scripts.
Continue reading →

OutBuffer, Parameter

PowerShell OutBuffer Parameter

The OutBuffer parameter determines how many objects will be buffered before calling the next cmdlet in the pipeline.

Instead of typing out -OutBuffer you can use -ob for short.
Continue reading →

ErrorAction, Parameter

PowerShell ErrorAction Parameter

Like many other aspects of PowerShell, -ErrorAction kind of explains itself when you think of it. Basically it instructs PowerShell what action to take when an error occurs. The actions you can set are Continue (which is default), Stop, SilentlyContinue and Inquire. Let’s take a look. Continue reading →

WhatIf, Parameter

PowerShell WhatIf Parameter

What if you just deleted 5000 accounts from your active directory domain by accident, what if there had been an easy way to make sure you were doing the right thing before the deletion. Would you have wanted to use it? I know I would. Just imagine you were planning on deleting all accounts which had been disabled for six months but you forgot some important switch and most of your accounts were gone because of that stupid switch.
Continue reading →

ErrorVariable, Parameter

PowerShell ErrorVariable Parameter

It is said that we learn from our mistakes, and that to improve learning it’s best to write things down. How about storing our mistakes and errors in a variable? If that’s not killing two flies with one stone, at least it’s a useful feature of PowerShell. Let’s use it and see how it works, using the Stop-Service cmdlet we try to stop a service: Continue reading →

Confirm, Parameter

PowerShell Confirm Parameter

Imagine you are feeling handy and start out to rebuild your bathroom. Now imagine you’re standing knee deep in water in your basement. I bet you wished that somewhere in your head there was a tiny voice which had asked you, “do you really want to drill there”? This is the purpose of the PowerShell -Confirm parameter. If you’re running a cmdlet which changes the system state you can use -Confirm in order to get a question asking you if you really want to go ahead with the change.
Continue reading →

OutVariable, Parameter

PowerShell OutVariable Parameter

Building on the Perl motto; “There’s more than one way to do it”, PowerShell lovers will tell you that they can play too. Basically the -OutVariable parameter stores the output from a cmdlet to a variable and at the same time letting the cmdlet display all the output to the screen. For example looking at the Get-ChildItem cmdlet you can store the output in a variable by doing:

Continue reading →

Get-ExecutionPolicy

Get-ExecutionPolicy

PowerShell uses for different settings called Execution Policy which governs how scripts will run on your computer and if they need to be digitally signed. Get-ExecutionPolicy is a Cmdlet which allows you to view which Execution Policy that is currently used by your computer. Continue reading →

Concerning Execution Policy

Execution Policy

Probably the first thing you ever do whenever you learn a new language is to write your hello world program, however in PowerShell the most simple script will cause it to crash!

Instead of the friendly greeting PowerShell will spit back: Continue reading →