We're starting to deploy a large amount of linked clones that require the zero client machine name to base network printer mappings too. I created this batch script to grab the volatile environment machine name key and shove it into a environmental variable but before I go on with the story, here's the batch script if anyone can use it for something else:
@echo off
FOR /F "tokens=4 delims= " %%A IN ('whoami.exe /user /sid') DO SET RegKey="HKU\%%A\Volatile Environment"
c:\windows\system32\reg.exe copy %RegKey% "HKCU\Volatile Environment" /f /s
c:\windows\system32\setx.exe (your variable here) -K "HKEY_CURRENT_USER\Volatile Environment\ViewClient_Machine_Name"
So a few weeks go by and the new guy on the staff get's asked to build another script to map the network printer... now he's never worked with VMware View before so keep that in mind. I go off to fix some end user issue and the next time I see him two hours later he's still working on trying to write the script but he asks me to come over and take a look at something so I do. He then proceeds to type in:
echo %ViewClient_Machine_Name%
into a command prompt and wouldn't you know... his zero client's name came up. I was like "wha??". So I had him log into his desktop using his iPad and try it again. Low and behold, the variable changed. I was like "no way". I had literally worked a half a day on that above script to get the variable created based on the key location within the HKEY_USER sub section of the registry. I guess my next question is why isn't that info documented more... The fact that all those volatile environmental entries in the registry are already made into environmental variables slipped past not only the View class I took but also 98% of all web pages out there. Grrr.