PowerShell Profile In Da Cloud

  • 0

PowerShell Profile In Da Cloud

Tags :

Category : Windows PowerShell

Line Break

Author: Frank Peter (93 Articles)

If you want to keep the same PowerShell Profile on more than one Windows computer, how about transfering the relevant common parts of the profile to a file share or even the Cloud? Actually, that’s a no-brainer!

Below, I outline my approach with a few brief strokes.

1. Identify the parts of both the console and the ISE profile that you want to share with all computers.
2. Create a “Documents\WindowsPowerShell” folder in the root of your (cloud) storage mount point.
3. Within that folder, save the profile code related to console sessions as “Microsoft.PowerShell_profile.ps1” and the ISE profile code as “Microsoft.PowerShellISE_profile.ps1”
4. Replace the “outsourced” profile code from the local profile scripts with a reference to their cloud-based equivalents:

Apart from dot-sourcing an existing external profile script, the above code initiales a global CLOUDPROFILE variable with the full file name of the cloud-based profile script. Thus it’s very easy to access that file for editing purposes or so.

The next code snippet works with ISE only and enables you to skip profile loading by holding down the left CTRL key:

Hope this helps


Leave a Reply

*