Scripting Blog [archived]

Formerly known as the "Hey, Scripting Guy!" blog

Hey, Scripting Guy! How Can I Use the If Statement in Windows PowerShell?

(image) Hey, Scripting Guy! I have a problem with a script I am trying to write. I have to evaluate between several conditions as they come into the script, but I do not understand the way the If statement in Windows PowerShell works. I even tried to use the Get-Help cmdlet to find Help, but when I use Get-Help If, it says it cannot find ...

Hey, Scripting Guy! How Can I Loop Through Collections with Windows PowerShell?

(image) Hey, Scripting Guy! Your article yesterday was fairly interesting. The problem is that every time that you looped through something, you needed to basically know how many times that you would loop because you needed to be able to count it. Also your analogy about walking on the beach was somewhat dumb. This is because to really ...

Hey, Scripting Guy! How Can I Use Windows PowerShell to Handle Mind-Numbing, Repetitive Tasks?

(image) Hey, Scripting Guy! I have a number of tasks that I always have to do. These tasks are somewhat repetitive, and I want to be able to write a Windows PowerShell script to eliminate the repetition. Is there something I can use to help with the mind-numbing repetition?- CH(image) (image) Hi CH, Ed here. Some repetition is good. For ...