I’m a great fan of Microsoft PowerShell and VMware PowerCLI to making my life easier through automation. When Microsoft and VMware released PowerShell for Mac OSX / High Sierra and PowerCLI I jumped at the chance. There are a few simple and short tasks to do that make your PowerCLI Core experience easier.
I should mention the installation… There are some great blogs on installing PowerShell Core and PowerCLI 10 so I will not cover that but you should read and implement their instructions to get the best PowerCLI Core experience.
Closing Terminal window
If you are ever faced with wanting to close either PowerShell or Terminal and the window does not close the window afterward this should help:
- Open Terminal
- Go to Terminal → Preferences
- Select the Settings tab
- Select your profile and choose the Shell tab
- Set When the shell exits to Close if the shell exited cleanly
Once this is set, when you type ‘exit’ in the terminal console, the window will close too.
Creating an Alias
I found that I could never remember that to load PowerCLI into Terminal once installed I need to type:
pwsh so I wanted to change that to something I could remember like
- Open Terminal
- Type the Esc key, Type
source ~/.bash_profile(This reloads the profile)
Once the alias is set, you can now type
powershell (Or whatever you changed it too) and PowerShell installed on your Mac will load.
On a Mac, you can create a profile to load your custom settings each time [Windows version on a previous blog] to again make your life a little easier.
The profile location on Max OSX is:
..which you can add text that you want each time PowerShell loads.
Set-Location ~/Dropbox/Scripts/ Clear-Host Write-Host 'Crispyland enabled'
I hope these few snippets will help make your PowerCLI Core just a little easier to use.