Visual basic and PowerShell output

~OSD~ 2,201 Reputation points
2022-12-20T09:58:06.637+00:00

272397-image.png

Hi,

I am using PowerShell to get the information about the OS Name, Time Zone etc.

I want this PS output to be displayed on VB.net form application.
Have three buttons on a vb form, is it possible to get output of the PS into the VB form?
272462-image.png

Windows for business | Windows Server | User experience | PowerShell
Developer technologies | VB
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. DaveK 1,871 Reputation points
    2022-12-20T12:49:32.65+00:00

    Is the form something your writing in VB and then wanting to call to powershell to grab that info? If so, can you not just read that info using VB?

    Do you want to click each button and it then does something to return that info from PS or are you just wanting the button text to show that information from PS?

    Unless I'm missing something obvious here it might be worth trying to clear up exactly what your goal is?


  2. Castorix31 91,506 Reputation points
    2022-12-20T13:10:00.77+00:00

    See threads like Unable To Get PowerShell Output
    (C#, but same code in VB...)
    (But you can use Win32 APIs with P/Invoke)


  3. MotoX80 37,161 Reputation points
    2022-12-20T17:04:05.023+00:00

    The Powershell cmdlet's are just issuing WMI calls. Just have your VB code call WMI directly.

    https://www.codeproject.com/questions/292691/help-with-wim-vb-net-coding

    https://www.emmet-gray.com/Articles/WMI_Intro.html

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.