I am getting following compilation issue in Powershell.
Add-PSSnapin : Cannot add Windows PowerShell snap-in VMware.VimAutomation.Core because it is already added. Verify the name of the snap-in and try again.
The error clearly mentions that I need to verify the name of the snap-in. It was added successfully when i execute first time itself.
How to verify snap-in exist ,if not then add?
You can load it if it's not loaded already:
if(-not (Get-PSSnapin VMware.VimAutomation.Core))
{
Add-PSSnapin VMware.VimAutomation.Core
}
You could also load it anyway and ignore the error:
Add-PSSnapin VMware.VimAutomation.Core -ErrorAction SilentlyContinue
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With