|
Post by chrisc on May 22, 2019 13:38:13 GMT
As part of our system imaging process we set some environment variables. Is it possible to read the current variable value and set a task sequence variable?
This is what I've tried so far;
<Action Type="WMIRead" Namespace="root\cimv2" Class="Win32_Environment" Property="VariableValue" KeyQualifier="Name=VM" Variable="TSVM" />
The environment variable name is VM
|
|
|
Post by Jason on May 22, 2019 17:06:26 GMT
Environment variables are directly available using %EnvVarName% already. See section 9.3.1 in the documentation for some detail.
|
|
|
Post by chrisc on May 22, 2019 18:17:10 GMT
Those variables aren't available if I am doing this from PXE for a refresh task sequence. Or I'm missing a step that enables them to be read.
|
|
|
Post by Jason on May 23, 2019 15:46:25 GMT
If you are in WinPE, then the environment variables for the OS on the system aren't available in any way regardless of the tool that you are using as they only exist when that OS is actually running so the New Computer scenario will never work. Why would you want to use existing environment variables for a New Computer scenario?
For the refresh scenario, if you want to preserve existing environment variables, you can simply store them in a TS variable at the beginning of the TS while running in the current OS and before rebooting into WinPE:
<Action Type="TSVar" Name="envTSVM">%TSVM%</Action>
|
|