Month: July 2010

WMI Query Language (WQL) – An introduction

These posts in the form of an ebook are available. Here are the links to all articles in this series of posts on WQL. 1. WMI query language – An introduction (this post) 2. WMI query language – Keywords and Operators 3. WMI query language – Data Queries: SELECT, FROM, and WHERE 4. WMI query language – Data Queries: Associators Of 5. WMI query language – Data Queries: References Of 6. WMI query language – Event Queries: Introduction 7. WMI query language – Event Queries: Syntax 8. WMI query language – Event Queries: Intrinsic Events 9. WMI query language – Event Queries: Extrinsic Events 10. WMI query language – Schema queries I have been using WMI a lot these days and got to play with WQL as well. In this series of posts, I want to write about how WMI Query Language (WQL) can be used to retrieve management data exposed by WMI. Yes, this has nothing to do with PowerShell but as a PowerShell lover (and a MVP now), I will use PowerShell for all …

MVP award in PowerShell

I am probably the last one to blog about the July 2010 MVP awards. I have not been able to update this blog regularly for several reasons. Anyway, on July 1st, I received the MVP award notification from MS. I did not even know about it until @msigeek called me up to give the news. I was thrilled and excited. I would like to thank @msigeek, @kaliyans and @indiaMVP for all their support. And, of course, the PowerShell community out there. You guys made me a MVP. Thank you..! Here is what I received as a part of MVP welcome kit.

Search and download scripts from TechNet Script Center repository

If you have ever used PoshCode, you can search & download scripts from PoshCode using PowerShell. They even have a module for that. PowerGUI provides features to search PoshCode and download/upload scripts to PoshCode from PowerGUI Script Editor. A similar script or an option does not exist for TechNet Script Center. So, this is my first attempt at that. The following module (not really, this is just version 0.001), provides the ability to search TechNet script center and download a specific script to disk. This uses TechNet Script Center search RSS feed for searching the repository and hence returns only top 20 results.So, version 0.1 will have the “real” search capabilities. In fact, there are many things not there in this version. There is no comment based help, there is no proper error handling, and etc. All this will get fixed soon. This is just proof-of-concept and leave your feedback here on what you want to see. This script is also available on the TechNet Script center

Using this is quite simple. Copy the …

Quick PowerShell Tip: Check if a given path is absolute or relative

You may, sometimes, want to check if a user provided file/folder path is relative or absolute and run the appropriate action based on the result. The System.IO.Path name space provides a simple method to verify that. That method is IsPathRooted(). This method will return True if the path is absolute and False if it is relative. The usage of this is quite simple.

This will result in $false as the path we provided is relative path. This is useful especially when we are validating parameters to a function. You can just use this as a part of ValidateScript. For example,

Test-Path1 will validate the parameter and continues only if the value of the parameter is absolute path.