Hi,
I have to set a List($ProjectName) as the value of an environment variable($PROJECTS).
The cmdlet which I tried is :
$remoteMachineList = 'machA', 'machB'
$ProjectName = 'ProjA', 'ProjB', 'ProjC'
foreach($remoteMachine in $remoteMachineList){ icm -comp $remoteMachine {[Environment]::SetEnvironmentVariable("PROJECTS",$ProjectName,"Machine")
}}
This doesn't throw any errors but it's not setting the value of it. If I give a string or an integer value directly instead of the $ProjectName in the above code, it's working fine.
PLease Help, Thanks in advance !