Creating COM and .NET Objects with Windows PowerShell 2

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
$objWord.Quit
$ips = [System.Net.Dns]::GetHostAddresses("www.dummies.com")
$ips | Select-Object IPAddressToString


dummies

Source:http://www.dummies.com/how-to/content/creating-com-and-net-objects-with-windows-powershe.html

No comments:

Post a Comment