by Patrick Ogenstad

There was a lot of love going around in May 2000, but as they say love hurts. If organizations would have had some code signing routines in place, the ILOVEYOU virus would have been killed in its crib.
Of course those hippie days are long gone as no one tends to allow .vbs files in the mail server or if it’s not blocked there the email client should block it.
However code signing can do more than just avoiding the mitigating click, still in this post I won’t focus on the security benefits of code signing.
Continue reading →
by Patrick Ogenstad

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

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 →
by Patrick Ogenstad

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 →
by Patrick Ogenstad

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 →
by Patrick Ogenstad

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 →
by Patrick Ogenstad

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 →
by Patrick Ogenstad

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 →
by Patrick Ogenstad

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 →
by Patrick Ogenstad

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 →