?
Solved

execute powershell on vbscript

Posted on 2011-10-17
3
Medium Priority
?
675 Views
Last Modified: 2012-05-12
Hello,

How can I execute a powershell script on vbscript?

Thanks
Regards
bibi
0
Comment
Question by:bibi92
3 Comments
 
LVL 6

Expert Comment

by:morpheios
ID: 36978598
Dim WshShell
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run "%comspec% /C powershell.exe yourscript.ps1", 0, True
0
 
LVL 65

Accepted Solution

by:
RobSampson earned 2000 total points
ID: 36983088
Hi, I've used this code.  You can remove the -noexit if you don't want the Powershell window to stay open.

Regards,

Rob.
strScript = "C:\Your Scripts\Script.ps1"
Set objShell = CreateObject("WScript.Shell")
strCommand = "powershell.exe -noexit &'" & strScript & "'"
objShell.Run strCommand, 1, True

Open in new window

0
 

Author Closing Comment

by:bibi92
ID: 36985108
Thanks
0

Featured Post

 The Evil-ution of Network Security Threats

What are the hacks that forever changed the security industry? To answer that question, we created an exciting new eBook that takes you on a trip through hacking history. It explores the top hacks from the 80s to 2010s, why they mattered, and how the security industry responded.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The following article is intended as a guide to using PowerShell as a more versatile and reliable form of application detection in SCCM.
Transferring FSMO roles is done when an admin wants to split roles between certain Domain Controllers or the Domain Controller holding the Roles has been forcefully demoted using dcpromo / forceremoval
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Loops Section Overview

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question