Tuesday, July 15, 2008

If (object exist) {...} in PowerShell..

In VB.NET I always used If Not Object is nothing just to be sure that I am working with real object.

In PowerShell, this can be done very easily:

If ($Object) {...}

or

If (!$Object) {...}

Easy, powerful and useful, I love this :)

Martin

1 comment:

Leslie Lim said...

I have a great fun reading your blogs.Thank you for making this beautiful and awesome blogs. Hope to read more post from you in the future. Please dont forget to visit me in my site @ www.imarksweb.org. Thank you.