Avatar of Wilder1626
Wilder1626
Flag 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
PowershellVisual Basic Classic

Avatar of undefined
Last Comment
Bill Prew

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Bill Prew

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23