troubleshooting Question

VB6 - Get Powershell script result via VB6

Avatar of Wilder1626
Wilder1626Flag for Canada asked on
PowershellVisual Basic Classic
1 Comment1 Solution122 ViewsLast Modified:
Hi, I normally use below Powershell script to pull the Windows Update status.

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

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

Thanks for your help
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 1 Comment.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros