PowerCLI shortcuts

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\Windows­PowerShell\profile.ps1

And if you want it to apply for all users, you can create (or edit)
%windir%\system32\Windows­PowerShell\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?

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s