You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.psd1 from my repo/Gist to somewhere like ~
Use Add-PSProfilePrompt or similar to modify $PSProfile, or modify the configuration file directly, and use Export-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-Profile that will pull my PSProfile.Configuration.psd1 from my repo or Gist and update ~\PSProfile.Configuration.psd1. Said function will use Import-PSProfileConfiguration once downloaded because it immediately updates $PSProfile without 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.
PluginPaths
Settings.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?
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 usingImport-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 theConfigurationPaths
property, not all the properties (if any) in$PSProfile
seem to be updated immediately, even after triggeringUpdate-PSProfileConfig
andRefresh-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:
PSProfile.Configuration.psd1
from my repo/Gist to somewhere like~
Import-PSProfileConfiguration ~\PSProfile.Configuration.psd1
Add-PSProfilePrompt
or similar to modify$PSProfile
, or modify the configuration file directly, and useExport-PSProfileConfiguration
. Update my repo/Gist with newly exported psd1.Update-Profile
that will pull my PSProfile.Configuration.psd1 from my repo or Gist and update~\PSProfile.Configuration.psd1
. Said function will useImport-PSProfileConfiguration
once downloaded because it immediately updates$PSProfile
without 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.PluginPaths
Settings.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)
The text was updated successfully, but these errors were encountered: