Opening the PowerCLI shortcut just to run a script gets a bit old when you basically live in it. I have scripts that I can open to do simple tasks like changing network adapters or adding a HDD, usually you would have to open the PowerCLI window and then cd to the directory where your scripts are and then execute them. Obviously that gets old, there is a better way! We can import the PowerCLI snapin and then automatically connect to your vCenter server. Heres how:
$vcserver = 'SERVER NAME'
$host.ui.rawui.WindowTitle="PowerShell [PowerCLI Module Loaded]"
Write-Host "PowerCLI imported Succesfully" -ForegroundColor green -backgroundcolor black
Write-Host "Connecting to vCenter, please wait.." -ForegroundColor yellow -backgroundcolor black
#Connect to vCenter
Write-Host "Ouch it broke!" -ForegroundColor red -backgroundcolor black
In this example you would have to add your vCenter server var to every script. That can get old as well, especially if you have a ton of scripts. A great way to fix this is to add a new environment variable to your computer (ie, vcserver = SERVER NAME), once that is done you can access that variable from any PS script by using $env:vcserver. Hope that helps!