I’ve just set up some shortcuts for connecting to our various VMware environments, as I was sick of typing out the full
connect-viserver vcsa-name.dns.name
every time.
If you want this to apply for just your userid, you can create (or edit if it already exists) %UserProfile%\Documents\WindowsPowerShell\profile.ps1
And if you want it to apply for all users, you can create (or edit)
%windir%\system32\WindowsPowerShell\v1.0\profile.ps1
I created the latter, and added lines such as:
function ENV1 {connect-viserver vcsa-name-1.dns.name} function ENV2 {connect-viserver vcsa-name-2.dns.name}
Now to connect to a VCenter, all I have to type is ENV1
Do you have any favourite powershell/powerCLI shortcuts like this?