Learn more with dummies

Enter your email to join our mailing list for FREE content right to your inbox. Easy!

Creating COM and .NET Objects with Windows PowerShell 2

By Steve Seguis

Part of Windows PowerShell 2 For Dummies Cheat Sheet

PowerShell 2 enables you to automate your Windows operating system, which entails dealing with objects: COM objects are created using the New-Object method with the comobject parameter, whereas .NET objects are created by enclosing the class name in square brackets. An example of each follows:

$objWord = New-Object -comobject "Word.Application"
$objWord.visible = $true
$ips = [System.Net.Dns]::GetHostAddresses("www.dummies.com")
$ips | Select-Object IPAddressToString