Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Collapse the table of content
Expand the table of content
Expand Minimize

Converting the Windows Script Host GetObject Method

Windows PowerShell

Definition: Retrieves an existing object with the specified ProgID, or creates a new one from a file.


The Get-Object method is used to connect to a COM object that is already up and running; this is typically used to connect to WMI or ADSI. (To connect to another object, such as Excel or Word, you need to use VBScript’s GetObject method. And yes, same name, slightly different functionality.)

Windows PowerShell doesn’t really have anything that corresponds directly to the GetObject method. However, you can use PowerShell’s type adapters as a way to connect to existing objects like WMI or ADSI. For example, this command provides a shortcut method for retrieving a specific object in WMI:

[WMI] 'Win32_Service.Name="Alerter"'

Meanwhile, this command connects to the local administrator account on the computer atl-fs-001:

$a = [ADSI]"WinNT://atl-fs-001/administrator"


See conversions of other Windows Script Host methods and properties.
Return to the VBScript to Windows PowerShell home page

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
© 2015 Microsoft