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 VBScript's Set Statement

Windows PowerShell

Definition: Assigns an object reference to a variable or property, or associates a procedure reference with an event.


You do not need to use the Set statement (or any sort of equivalent keyword/command) in order to create an object reference in Windows PowerShell. Instead, you simply use the New-Object Cmdlet, followed by (in the case of COM objects) the -comobject parameter and the ProgID of the object to be created.

For example, the following two commands create an instance of Microsoft Excel and then, just to prove that the instance of Excel was created, make the application visible onscreen:

$a = new-object -comobject Excel.Application
$a.visible = $True

Return to the VBScript to Windows PowerShell home page

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