-
Notifications
You must be signed in to change notification settings - Fork 7
Description
Thanks for all your help so far.
I notice the variables under $PSProfile.Variables.Environment aren't clobbered if the PSProfile configuration is imported by leveraging the $PSProfile.ConfigurationPaths. However they are clobbered if I import using Import-PSProfileConfiguration.
It seems the benefit of using Import-PSProfileConfiguration is that the $PSProfile object is immediately updated within the user's current session. Whereas if I just modify the ConfigurationPaths property, not all the properties (if any) in $PSProfile seem to be updated immediately, even after triggering Update-PSProfileConfig and Refresh-PSProfile.
I'm trying to devise a workflow that enables quick install of my PSProfile configuration and easy update too. An ideal workflow for install and update would work like:
- Download
PSProfile.Configuration.psd1from my repo/Gist to somewhere like~ Import-PSProfileConfiguration ~\PSProfile.Configuration.psd1- Use
Add-PSProfilePromptor similar to modify$PSProfile, or modify the configuration file directly, and useExport-PSProfileConfiguration. Update my repo/Gist with newly exported psd1. - Invoke some custom function that I'll likely store as an init script e.g.
Update-Profilethat will pull my PSProfile.Configuration.psd1 from my repo or Gist and update~\PSProfile.Configuration.psd1. Said function will useImport-PSProfileConfigurationonce downloaded because it immediately updates$PSProfilewithout needing to reload.
The problem for me is in step 3, I don't want manually strip out user and machine specific properties before uploading to some location. There's more than just what's under $PSProfile.Variables.Environment which is machine and user specific too, e.g.
PluginPathsSettings.ConfigurationPath
I have an idea which might help but I'm not sure how to create in PSProfile. What if Export-PSProfileConfiguration offered some parameter to exclude named properties? That could get a little tricky for usage for the user, e.g. how would they specify child properties such as $PSProfile.Settings.ConfigurationPath in the parameter. But it's probably the most flexible idea because if you just offered a switch instead -ExcludeMachineUserSpecificInfo (terrible name I know, but stick with me) then this means you're deciding for the user what properties they can only exclude with little flexibility.
However, maybe I shouldn't be using Import-PSProfileConfiguration after download and maybe I should just ensure $PSProfile.ConfigurationPaths includes ~\PSProfile.Configuration.psd1 and just reload my session if a new version is detected. What's your opinion?
Originally posted by @codaamok in #37 (comment)