VMware Cloud Community
YuriyShleymovic
Contributor
Contributor

how to execute PowerCLI command or script from command line.



Hello,


when I have to run script from powershell I use next command:

U:\>powershell -file C:\VMWareTest\test1.ps1



Of cause it does not know the vmware commands, like 'get-vm':


How can I run PowerCLI script as one command line, similar to powershell "-file" option.


thank you,

0 Kudos
1 Reply
LucD
Leadership
Leadership

Did you make sure the PowerCLI PSSnapin is loaded ?

Is there an Add-PSSnapin cmdlet in the .ps1 file ?


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

0 Kudos