SSM User does not have access to System Environment Variables

86 Views Asked by At

I am using Windows 10 on the servers where we run a .NET application, I need the machines to have environment variables to run a script that call those variables. I used this command as Administrator: [Environment]::SetEnvironmentVariable("MYVARYABLE", "variable_value", [System.EnvironmentVariableTarget]::Machine)

And it was added to the System Variables when I RDP into the Windows Machine and I can run the script that has a reference to $env:MYVARYABLE, I updated the environment using chocolatey refreshenv.

However, when I connect to the Instance using SSM (AWS Systems Manager), I don't longer have access to the environment variables, even though they are set as System Environment Variables.

I want to know why and what would be the best option to run that script from SSM Run Command, or when I connect to the Instance.


UPDATE

When I reboot the Instance from AWS, it has access now to the System Variables on the SSM User, I thought chocolatey refreshenv would do the work but it did not apparently, is there any way I can refresh those variables to be available without the need of restarting the machine?

0

There are 0 best solutions below