Here we have a simple VBS that can be used at published aplicattions on Citrix XenApp (Presentation Server), or running local applications with their necessary mapped network drivers.
This script map network drivers and open an application.

Letra = “S:”
‘Precisa ser letra maiuscula
Caminho = servidorshare
Aplicativo = Letra & “teste.exe”


Set WshShell = WScript.CreateObject(”WScript.Shell”)
Set WshNetwork = WScript.CreateObject(”WScript.Network”)
Set AllDrives = WshNetwork.EnumNetworkDrives()
driveconectado = False
For i = 0 To AllDrives.Count – 1 Step 2
If AllDrives.Item(i) = Letra Then driveconectado = True
Next
If driveconectado = True then
WShNetwork.RemoveNetworkDrive Letra
End if
WShNetwork.MapNetworkDrive Letra, Caminho
WshShell.Run Aplicativo