Link to home
Start Free TrialLog in
Avatar of stghelpdesk
stghelpdesk

asked on

VBS Script to map Q drive to user Profile on remote server

Hi,

I have problem on my citrix servers (XenApp 5), I have Application that need Q drive to map to users Profile under Document and Settings. I tried to write VBS Script to do that (See below Script) Problem I am having is Some users it works but lots of them getting "Bad File Name or Number" also what make it hard for us is we use Tsprofile on our file server for their profile. So Here is script....


Set WshShell = Wscript.CreateObject("Wscript.Shell")
Set objFSO =  WScript.CreateObject("Scripting.Filesystemobject")

'========================================================================================================
'The Meat

CWSSub
RunCWS


'========================================================================================================
' Begin Subs
Sub CWSSub ()
      wscript.sleep 2000
      WshShell.Run "subst q: /D",0,True
      
      wscript.sleep 2000
      WshShell.Run "subst q: %HOMEPATH%",0,True

End Sub

Sub RunCWS()

          wscript.sleep 2000
          If objFSO.FileExists("c:\CLAIM\BIN\CLAIM.EXE") Then
                WshShell.Run "c:\CLAIM\BIN\CLAIM.EXE",0,True
          Else
                MsgBox "c:\CLAIM\BIN\CLAIM.EXE is not a valid path on your system."
          End If

End Sub
ASKER CERTIFIED SOLUTION
Avatar of acbxyz
acbxyz
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Dirk Kotte
exactly this do the rootdrv-script included with every windows TS.
(search for rootdrv.cmd)