Although officially the PowerCLI cmdlets are only supported by VMware when running the PowerCLI console it is possible to add the majority of the PowerCLI cmdlets by manually adding the VMware.VimAutomation.Core snapin in your current console:
Add-PSSnapin -Name VMware.VimAutomation.Core |
This is particularly useful when running PowerCLI script from the task scheduler as the scripts can just be executed using PowerShell.
As suggested in the comments it is also possible to add all registered VMware PSSnapin’s by runing the following code:
Get-PSSnapin -Registered | Where-Object {$_.Name -like 'vmware*'} | ForEach-Object { Add-PSSnapin -Name $_.Name } |
Great tip! You can also do something like the following to add all registered PSSnapins:
Get-PSSnapin -Registered |
where name -like vmware* | foreach {
Add-PSSnapin $_.Name
}
Thanks! That is indeed to include in the tip, I have updated the code in the blog post.