Windows PowerShell Home
PS4 - Desired State Configuration Environment Variable Provider Does Not Broadcast WM_SETTINGCHANGE
Keith Hill MVP
7/3/2013 4:04:27 PM
User(s) can reproduce this bug
When you use a DSC configuration to create a new environment variable, that variable is not visible on the system (even in a new PowerShell window) until you sign out or restart the system. That is because the provider, when it sets the variable, does not cause a WM_SETTINGCHANGE message to be broadcast.
How often does this happen?
Have you seen this problem before in this product?
No, this is new to the most recent version
Create an environment variable config like so:
Ensure = "Present"
Name = "TestEnvironmentVariable"
Value = "TestEnvValue"
The you start the configuration (after generating the MOF file). Now start up a new cmd.exe or Powershell.exe process. Try to access %TestEnvironmentVariable% or $env:TestEnvironmentVariable. It is not defined in these new processes. If you restart your machine then these variables will be available.
You should not have to restart your system to see the new environment variables. In PowerShell if I use [environment]::SetEnvironmentVariable("foo", "value", "Machine") it will broadcast a WM_SETTINGCHANGE message and any new processes I start will have that environment variable defined. The DSC env provider should also broadcast this window message.
to post a comment.
Please enter a comment.
to post a workaround.
Please enter a workaround.
© 2013 Microsoft