You can install snap-ins to PowerShell in order to extend the functionality. Examples include the PowerCLI for VMware and the Exchange snap in. Basically, these snap-ins include libraries of additional commands that you can use to perform automation. However, if you simply create powershell scripts (.ps1 files) with these commands, you will get errors because the default enironment does not include the snap in(s).
To add a snap in to the powershell environment automatically, you use a powershell script that is invoked every time you start powershell. This is the profile.ps1 file, located in C:\Windows\System32\WindowsPowerShell\v1.0. You may have to create the profile.ps1 file, as it is not needed for the default environment.
One syntax to add a snap in to the default environment is this:
$VMCore = Get-PSSnapin VMware.VimAutomation.Core -EA 0
if ( -not $VMCore ) { Add-PSSnapin VMware.VimAutomation.Core }
You can find examples of other syntax online, but the core behavior is this: Check if the snap in is active, and if it isn't there use the Add-PSSnapin commandlet to add it.
Caveat: You must download and install the snap in on your system before you can add it to your default PowerShell environment. For example, the VMware.VimAutomation.Core is installed with the PowerCLI software from VMware.
Note: I have added the VMware automation snap in to the default environment on the Security Bank management servers. Additionally, I've put a script on these servers that will check for any VM snapshots. (D:\cnx\scripts\List_Snapshots.ps1)