PowerShell Basics: Getting the job done

Warning: this post contains a lot of personal opinion.

In my recent post http://msmvps.com/blogs/richardsiddaway/archive/2011/05/16/scripting-games-commentary-xiii-ping.aspx

I showed that there were a number of ways of “pinging” a remote machine:

  • Using Ping
  • Using WMI
  • Using .NET
  • Using cmdlet

In many cases there isn’t a cmdlet available to do the job we want (we will never see a cmdlet to perform every possible job) but we might be able to find some .NET, WMI or COM class that we can use to do the job.

In many cases there is only one way to get the job done but a lot of the time we may find multiple possibilities. A frequent question is along the lines of “Which is better WMI or .NET” – add COM where appropriate.

The simple answer is all of them. As an admin my objective is to get the job done. I’ll use the tool that gives me the answer. I regularly use WMI, .NET and COM.  If I find a script on the Internet to solve me problem I will use it.

PowerShell makes it easy to work with .NET, WMI and COM. Don’t agonise over which to use – solve your original problem.

This entry was posted in Philosophy, PowerShell V2. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s