Have you ever wanted to get a list of all WMI methods present inside a specific WMI class – plus a meaningful description and a list of all the supported return values? Here is how: $class = [ wmiclass ] "Win32_NetworkAdapterConfiguration"...

In a previous tip, you discovered how to search for WMI classes like Win32_VideoController. Now, what exactly is the purpose of this class? You can retrieve Help information for any WMI class with the next lines of code,: $class = [ wmiclass ] 'Win32_VideoController'...

WMI is a huge repository. If you want to get to useful information, you will need to specify the name of a valid WMI class. Fortunately, it is easy to search for interesting classes. You can simply use Get-WmiObjectand the -list parameter in conjunction...

WMI can also read any drive label (the name that appears next to a drive inside Explorer), and you can change the drive label, too—provided you have administrator privileges. This code renames drive c:\ to "My Harddrive": $drive = [ wmi...

One little known fact is that Where-Object is a cool and simple way of removing empty objects. Let's say you want to list all network adapters that have an IP address. You can simply add Where-Object and specify the object property that needs to have...

Try this quick and simple way to find out the domain name that you are currently connected: [ ADSI ] "" The domain name is returned if you are currently connected to a domain. Otherwise, you will receive an exception. You can also return arbitrary...

Get-Credential is a great way of prompting for credentials, but the Password you enter into the dialog will be encrypted. Sometimes, you may need a clear text password. Here is one way to restore the clear text password entered into the dialog: $cred...

Whenever possible, try to avoid raw .NET access if you would like to create more readable code. For example, the following line returns the current date: [ System.DateTime ]:: Now Here is a much better approach: simply use Get-Date: Get-Date Remember...

You can use the -contains operator if you need to check whether a specific version of .NET is present on your system: @(dir $env:windir \ Microsoft.NET \Framework\v * -name ) -contains 'v3.0' ReTweet this Tip!

Try this if you would like to get a quick overview of all installed .NET framework versions: dir $env:windir \ Microsoft.NET \Framework\v * -name It will then return a string array with all installed .NET framework versions. ReTweet this Tip!

Here is a new way of getting help for your PowerShell cmdlets: If you are inside the U.S., try this: http://go.microsoft.com/fwlink/?LinkID=190436 If you are outside the U.S., visit this page: http://www.bing.com/visualsearch?mkt=en-us&g=powershell_cmdlets...

Usually, to create time spans, you will use New-Timespan. However, you can also use a more developer-centric approach by converting a number to a time span type: [ TimeSpan ]100 This will get you a time span of 100 ticks, which is the smallest unit available...

However, to use developer-centric date-time methods, you will need to know them first. Here is how: Get-Date | Get-Member -memberType * Method This will give you a list of all methods provided by date-time objects. To add six years to today's date...