VMware Cloud Community
COS
Expert
Expert

Using PowerCLI with Visual Studio (.Net VB)

Anyone know a  quick Dummys guide to getting PowerCLI to work with Visual Studio .Net VB?

Note, not looking to use C#.

Need how to's and example codes.

Thanks

0 Kudos
2 Replies
LucD
Leadership
Leadership

Do you mean running a PowerShell script, with PowerCLI cmdlets, from a VBS script?


In that case it is quite simple.

The VBS script

Dim objShell

Set objShell = WScript.CreateObject("WScript.Shell")

objShell.Run "powershell.exe -noexit C:\Scripts\test.ps1"

Set objShell = Nothing

The content of the .ps1 file.
With module auto-loading you don't need to do any Import-Module

Get-PowerCLIConfiguration

Or do you mean something different?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
COS
Expert
Expert

No. Mean something different.

I have a Visual Studio .Net VB project/form and I want to use PowerCLI commands and be able to return the values into a listbox or combo box or be able to parse (preferred) through the output of the PowerCLI command and insert them in a listbox or combo box.

Thanks

0 Kudos