Hi folks, I was playing around with automating settings for Profile Manager today and realized that profilever doesn’t get automatically set by OS.  You could go into Properties of my computer and try to set System Variables manualy, here is an automatic way to do that, something you can add to the onStartup script by GPO: 

NOTE: You have to reboot the computer once after the policy applies before the user can start logging on, else instead of creating a directory windows\winXP for example – you will get: windows%profilever% in the user’s home dir.

'================================
'
' This script will set a <span class="code-keyword">new</span> ValueName: <span class="code-quote">"profilever"</span> to Value of current OScaption under:
' HKLM\<span class="code-object">System</span>\CurrentControlSet\Session Manager\Environment
'
' The profilever is a <span class="code-object">System</span> variable used by Citrix Profile Manager
' Windows%ProfileVer%  &lt;- it's so that <span class="code-keyword">this</span> setting will work!
'
' Written by: Mark Vinokur
' Date: 12 Dec 2009
' Version: 1.1 (updated to work with Windows 7)
'================================
'First Check <span class="code-keyword">if</span> Registry Value Exists
'http:<span class="code-comment">//www.microsoft.com/technet/scriptcenter/resources/qanda/oct04/hey1029.mspx
</span>'Const HKEY_CURRENT_USER = &amp;H80000001 (we will be using HKLM not HCCU)
Const HKEY_LOCAL_MACHINE = &amp;H80000002
strComputer = <span class="code-quote">"."</span>

Set objRegistry = GetObject(<span class="code-quote">"winmgmts:"</span> _
&amp; <span class="code-quote">"{impersonationLevel=impersonate}!\\"</span> _
&amp; strComputer &amp; <span class="code-quote">"\root\<span class="code-keyword">default</span>:StdRegProv"</span>)

Set StdOut = WScript.StdOut
strKeyPath = <span class="code-quote">"SYSTEM\CurrentControlSet\Control\Session Manager\Environment"</span>
strValueName = <span class="code-quote">"ProfileVer"</span>
objRegistry.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue

'Check <span class="code-keyword">if</span> the registry string Value is blank, <span class="code-keyword">if</span> it is NOT blank, skip <span class="code-keyword">this</span> script
If IsNull (strValue) Then
 'The following function will <span class="code-keyword">return</span> a strValue
 'which we will use in setting the registry strValueName
 WhatOS()
 'Wscript.Echo <span class="code-quote">"Detected the Following OS: "</span> &amp; strValue
 objRegistry.SetStringValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, strValue
Else
 'Uncomment <span class="code-keyword">this</span> section <span class="code-keyword">for</span> testing (to figure out what the current Value is set to
 'objRegistry.GetStringValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, strValue
 'StdOut.WriteLine <span class="code-quote">"Current ProfileVer Value is set to: "</span> &amp; strValue
End If

'====================================
' Subs and Functions
'====================================
'==========
'= Detect what OS version
'==========
sub WhatOS()

 '  Dim strCurrentOSCaption 'We will use WMI to pull <span class="code-keyword">this</span> out
 '  Dim CurrentOSValue
 '  Dim pos == 0 'For searching <span class="code-keyword">for</span> inStr, <span class="code-keyword">if</span> pos &gt; 0 we know we have a hit

  'dim strCurrentOSCaption
  Set dtmConvertedDate = CreateObject(<span class="code-quote">"WbemScripting.SWbemDateTime"</span>)

  strComputer = <span class="code-quote">"."</span>
  Set objWMIService = GetObject(<span class="code-quote">"winmgmts:"</span> _
      &amp; <span class="code-quote">"{impersonationLevel=impersonate}!\\"</span> &amp; strComputer &amp; <span class="code-quote">"\root\cimv2"</span>)

  Set colOperatingSystems = objWMIService.ExecQuery _
      (<span class="code-quote">"Select * from Win32_OperatingSystem"</span>)

                For Each objOperatingSystem in colOperatingSystems
                                strCurrentOSCaption =  objOperatingSystem.Caption
                                'Wscript.Echo <span class="code-quote">"CurrentOSCaption: "</span> &amp; strCurrentOSCaption
                Next

  'We are using a TXT compare, to compare binary use 0 at end
  If (inStr(1,Lcase(strCurrentOSCaption),<span class="code-quote">" xp "</span>, 1) &gt; 0) then
   currentOSValue = <span class="code-quote">"WinXP"</span>
  ElseIF (inStr(1,Lcase(strCurrentOSCaption),<span class="code-quote">" vista"</span>, 1) &gt; 0) then
   currentOSValue = <span class="code-quote">"Vista"</span>
   ElseIf (inStr(1,Lcase(strCurrentOSCaption),<span class="code-quote">"2000"</span>, 1) &gt; 0) Then
    currentOSValue = <span class="code-quote">"2000"</span>
   ElseIf (inStr(1,Lcase(strCurrentOSCaption),<span class="code-quote">"2003"</span>, 1) &gt; 0) Then
    currentOSValue = <span class="code-quote">"2003"</span>
   ElseIf (inStr(1,Lcase(strCurrentOSCaption),<span class="code-quote">"2008"</span>, 1) &gt; 0) Then
    currentOSValue = <span class="code-quote">"2008"</span>
   ElseIf (inStr(1,Lcase(strCurrentOSCaption),<span class="code-quote">"Windows 7"</span>, 1) &gt; 0) Then
    currentOSValue = <span class="code-quote">"Win7"</span>

  Else
   currentOSValue = <span class="code-quote">"unknownOS"</span>
  End IF

  'Lastly check <span class="code-keyword">if</span> we're inside a x64 bit os, and add it to the string
  If (inStr(1,Lcase(strCurrentOSCaption),<span class="code-quote">"x64"</span>, 1) &gt; 0) Then
     currentOSValue = currentOSValue &amp; <span class="code-quote">"x64"</span>
 End If

 'Wscript.Echo <span class="code-quote">"Current OS: "</span> &amp; CurrentOSValue
 strValue = CurrentOSValue

end sub