Accessing Static .NET

You can start to explore the power of .NET with PowerShell's built-in .NET access.. All you will need are square brackets to access static classes. For example, here is a code snippet that resolves a host name:

[system.net.Dns]::GetHostByName('microsoft.com')

Using PowerShell Plus, you can find out what .NET classes and methods are available. It will show code completion once you enter a "::" after a type (in square brackets) or "." after an object or variable for dynamic members.


Posted Dec 17 2008, 08:00 AM by ps1
Concentrated Tech NSoftware Dell Compellent Sponsored by Idera and Concentrated Tech and NSoftware and Dell Compellent
Copyright 2011 PowerShell.com. All rights reserved.