PSReadLine icon indicating copy to clipboard operation
PSReadLine copied to clipboard

Set-PSReadLineOption - Persistent configuration without profile.ps1

Open Skons opened this issue 7 years ago • 3 comments

When Set-PSReadLineOption is used, that data is only for the current session. I am unable to force configuration outside of the profile.ps1. This is handy when for instance -HistorySaveStyle needs to be SaveNothing for administrators on shared computers (you'll never know what they leave behind). It would be nice of that configuration could be pushed, into for instance the registry, trough GPO. The reason i prefer GPO over the profile.ps1 is that -noprofile can be used with powershell.exe. In that way the module can be forced in all powershell instances.

Environment data

PS version: 5.1.17134.165 PSReadline version: 2.0.0-beta2 os: 10.0.17134.1 (WinBuild.160101.0800) PS file version: 10.0.17134.1 (WinBuild.160101.0800)

Skons avatar Jul 27 '18 12:07 Skons

Rather than create another set of GPO objects and client-side handlers, why not just DIY it with existing features.

You could have a computer logon script copy the profiles from some central site. That way each time the system reboots you get a freshly updated profile. Use the All users All profiles (ie $Profile.AllUsersAllHosts). You could still have user level profiles (this user, all hosts, or this user this host) to augment the global profile.

doctordns avatar Aug 02 '18 22:08 doctordns

Please is there any way to persist the setting set with Set-PSReadlineOption -HistorySavePath ? It only works presently for a session

olawalejuwonm avatar Apr 11 '23 12:04 olawalejuwonm

@olawalejuwonm You can put Set-PSReadlineOption -HistorySavePath in your profile, which will run when you start a new session. See https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_profiles?view=powershell-7.3

daxian-dbw avatar Apr 11 '23 16:04 daxian-dbw