Run powershell-scripts from vb-script
Here’s a “wrapper”-script to run powershell-scripts from VB-script.
Dim objShell,objFSO,objFile
Set objShell=CreateObject(”WScript.Shell”)
Set objFSO=CreateObject(”Scripting.FileSystemObject”)
’Path to script
strPath=”c:\script\Update-Exchange.ps1″
If objFSO.FileExists(strPath) Then
set objFile=objFSO.GetFile(strPath)
strCMD=”powershell -nologo -command ” & Chr(34) & “&{” &_ objFile.ShortPath & “}” & Chr(34)
‘WScript.Echo strCMD
‘0 hides window
‘1 shows window
objShell.Run strCMD,0
Else
WScript.Echo “Can’t find ” & strPath
WScript.Quit
End If