How to verify snapin before add?

Question:

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?

Answer:

You can load it if it’s not loaded already:

You could also load it anyway and ignore the error:

Source:

How to verify snapin before add? by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply