Link to home
Start Free TrialLog in
Avatar of Wilder1626
Wilder1626Flag for Canada

asked on

VB6 - Get Powershell script result via VB6

Hi, I normally use below Powershell script to pull the Windows Update status.

get-service wuauserv | select Displayname,Status,ServiceName,Can*

Open in new window


Now what i would like to do is to run that script via my VB6 application.
So by clicking on a button, it give me the result in a msgbox.

I'm able to do it for the "ipconfig" but not able for "wuauserv"

This is what i have so far:
Private Sub Command1_Click()
'get-service wuauserv | select Displayname,Status,ServiceName,Can*

Dim WshShell, oExec
Set WshShell = CreateObject("WScript.Shell")

Set oExec = WshShell.Exec("ipconfig")

Do While oExec.Status = 0
     'WScript.Sleep 100
Loop
MsgBox oExec.StdOut.ReadAll
End Sub

Open in new window


Thanks for your help
ASKER CERTIFIED SOLUTION
Avatar of Bill Prew
Bill Prew

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial