Wondering what tools are available to remotely edit (find and replace actually) the PATH environment variable on all users workstations across the enterprise? We do use SCCM (formerly SMS), but I don't know if that provides the capability to do that. Is this possible with Powershell maybe?
Windows – How to edit users PATH environment variable remotely in Windows
environment-variableswindows
Related Topic
- Windows – How to Add a Windows Environment Variable Without Rebooting
- Windows – How to set a Windows user environment variable that takes effect for the current session
- Windows environment variables and manual registry editing – no/wrong values issue
- Windows – How to install RSAT on remote Windows 7 workstations using Powershell in 2003 AD
- Windows – Python: How to i read the environment variables / user path variables from another user
- ssh – PATH Not Set After SSH from MacBook to Windows
Best Answer
I'd caution you about doing what Nick O'Neil suggests insofar as just blindly overwriting the PATH variable in the registry of all your client computers is likely to cause problems.
A quickie one-liner for a search-and-replace on a literal string in PowerShell would be (long line wrapped for readability-- this is all a single line):
Set-ItemProperty "HKLM:SYSTEM\CurrentControlSet\Control\Session Manager\Environment" Path -value ( (Get-ItemProperty "HKLM:SYSTEM\CurrentControlSet\Control\Session Manager\Environment" Path).Path -replace "OLD STRING", "NEW STRING")
You could run that as an Active Directory Startup Script on the affected computers. You could even get fancy and put some kind of flag in the registry (join the computer to a group that's denied rights to apply the GPO again, etc) to make the script only run once per computer.