Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Integrating PowerShell and VBScript

Status
Not open for further replies.

markdmac

MIS
Dec 20, 2003
12,340
US
Just wondering if anyone else has been toying with integrating PowerShell and VBScript?

Today I wrote a VBScript which executes and launches a saved PowerShell PS1 script.

Basically all that is needed is to use WSHShell to run an instance of CMD.EXE and then execute PowerShell.exe with the PS1 file as an argument.

The trick however on XP to getting this to work was to set the zone for the PS1 file. You need to set it to zero to ensure you are not prompted to continue running the script.

To set a zone on a PS1 do the following.

notepad scriptname.PS1:Zone.Identifier

Set the zone to 0 as follows.

[zonetransfer]
ZoneId=0

I next want to play with passing arguments from vbscript to PowerShell. Anybody done this yet?

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
Hey Mark, don't know if these will help but you might look at the June 1/June 2 Power Tips at PowerShell.com:
They don't talk about passing arguments, but it's a different way to run PowerShell that might give you ideas.

Also, Sapien has a free download called ActiveX PowerShell, that allows you to use PowerShell as a COM component from VBScript/JScript/etc. Might be useful:
 
Thanks crobin1.

I did manage to figure out what I was looking to do and have created a tool that integrates with ADUC to allow me to export user mailboxes via a right click choice.

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top