Entries from May 2008 ↓
May 26th, 2008 — PowerShell

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 →
May 26th, 2008 — PowerShell

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 →
May 21st, 2008 — PowerShell

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 →
May 19th, 2008 — PowerShell

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 →
May 7th, 2008 — PowerShell

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 →
May 1st, 2008 — PowerShell

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 →