如何解决登录脚本以在VDI内映射打印机
| 我所拥有的是人们想要使用iPad访问VDI图像。我之前创建了一个脚本,该脚本将根据用户在AD中的位置来映射用户。由于我无法将parm文件从iPad传递到VDI图像,因此这不适用于iPad。我现在正在寻找一种方法,如果没有parm文件,则将退出脚本。 这是我的脚本:您认为检查用户是否在iPad上的最佳方法是什么?如果它们在iPad上,如何关闭而不运行此脚本?\' *********************************************************************
\' Assign default printer for Citrix Server based on pulled PARM file
\'
\' v100a XXX xx/xx/xxxx - Original Version
\' v110a MRH 03/24/2010 - Removed V: Drive reference and
\' changed it to UNC Path.
\' - Added Execute FastLaunch on
\' change of Default Printer from
\' RightFax to something else.
\' v120a MRH 03/25/2010 - Made reading of the Param file
\' more robust. It must be at least
\' 8 characters in length.
\' v130a MRH 04/02/2010 - If pnagent.exe is already running
\' do not attempt to launch it again.
\' v140a MRH 04/02/2010 - More error checking around reading
\' the C:\\oasGold\\oaaparm.ini file.
\' Locate the = and read from there.
\' v150a MRH 05/14/2010 - Fixed Determining if the printer is
\' moved from RightFax to other printer.
\'
\' *********************************************************************
Option Explicit
Dim objFSO,objFile,objFileS,strLine,ParmID,net,WshNetwork,Counter
Dim eqLoc
Dim OShell,exestr
Dim oReg,strKeyPath,strValue
\' Create Shell object for running command
set Oshell = CreateObject(\"Wscript.Shell\")
\'creates network object for printer setup later
Set net = CreateObject(\"WScript.Network\")
Set WshNetwork = WScript.CreateObject(\"WScript.Network\")
\'Open the fso
Set objFSO = CreateObject(\"Scripting.FileSystemObject\")
\' copy the Param file from thin client to C:\\
\' Map Printer Based on the Param File.
If objFSO.FileExists(\"\\\\Client\\C$\\oasgold\\oaaparm.ini\") then
\'copy parm file from thin client to citrix virtual disk
Objfso.copyFile \"\\\\Client\\C$\\oasgold\\oaaparm.ini\",\"C:\\oasgold\\\",TRUE
Set objFileS = objFSO.GetFile(\"C:\\oasGold\\oaaparm.ini\")
If (objFileS.Size >= 8) Then
\'creates file object and opens parm file
Set objFile = objFSO.OpenTextFile(\"C:\\oasGold\\oaaparm.ini\",1)
\'reads first line of parm file into strLine
strLine = LCase(objFile.ReadLine)
\'Locate the equal and read the ParmID,the next 4 characters
\'If no equals then set param to ????
eqLoc = InStr(1,\"=\",1)
If (eqLoc > 0) then
ParmID = Mid(strLine,eqLoc+1,4)
Else
ParmID = \"????\"
End If
\' Close Param file.
objFile.Close
Else
\' Unable to Read Param File,set it to something unique to notify us that the files is bad.
ParmID = \"????\"
End If
\'based on Parm ID select which printer to setup
Select Case ParmID
Case \"????\"
Wscript.Echo \"Invalid Parm ID: \" & ParmID & \". No Windows printer selected!!!\"
Case \"xxxx\"
Wscript.Echo \"Invalid Parm ID: \" & ParmID & \". No Windows printer selected!!!\"
Case \"iej3\"
net.AddWindowsPrinterConnection \"\\\\print1\\e-it-hal4000-ps\"
WshNetwork.SetDefaultPrinter \"\\\\print1\\e-it-hal4000-ps\"
Case \"c5in\"
net.AddWindowsPrinterConnection \"\\\\print1\\E-4E1-MFD-PS\"
WshNetwork.SetDefaultPrinter \"\\\\print1\\E-4E1-MFD-PS\"
Case \"f8it\"
net.AddWindowsPrinterConnection \"\\\\print1\\E-4E1-MFD-PS\"
WshNetwork.SetDefaultPrinter \"\\\\print1\\E-4E1-MFD-PS\"
Case \"f7it\"
net.AddWindowsPrinterConnection \"\\\\print1\\ep-spc2-mfd-ps\"
WshNetwork.SetDefaultPrinter \"\\\\print1\\ep-spc2-mfd-ps\"
Case \"iel4\"
net.AddWindowsPrinterConnection \"\\\\print1\\e-2ne1-ps\"
WshNetwork.SetDefaultPrinter \"\\\\print1\\e-2ne1-ps\"
Case \"iel9\"
net.AddWindowsPrinterConnection \"\\\\print1\\e-2nw1-ps\"
WshNetwork.SetDefaultPrinter \"\\\\print1\\e-2nw1-ps\"
Case \"iei3\"
net.AddWindowsPrinterConnection \"\\\\print1\\e-4n1-ps\"
WshNetwork.SetDefaultPrinter \"\\\\print1\\e-4n1-ps\"
Case \"ieh5\"
net.AddWindowsPrinterConnection \"\\\\print1\\e-5sfrt-ps\"
WshNetwork.SetDefaultPrinter \"\\\\print1\\e-5sfrt-ps\"
Case \"iee8\"
net.AddWindowsPrinterConnection \"\\\\print1\\e-5n1-ps\"
WshNetwork.SetDefaultPrinter \"\\\\print1\\e-5n1-ps\"
Case \"7jq6\"
net.AddWindowsPrinterConnection \"\\\\print1\\e-ns-5sinpat-ps\"
WshNetwork.SetDefaultPrinter \"\\\\print1\\e-ns-5sinpat-ps\"
Case \"ieg5\"
net.AddWindowsPrinterConnection \"\\\\print1\\e-6e1-ps\"
WshNetwork.SetDefaultPrinter \"\\\\print1\\e-6e1-ps\"
Case \"ieg7\"
net.AddWindowsPrinterConnection \"\\\\print1\\e-6n2-ps\"
WshNetwork.SetDefaultPrinter \"\\\\print1\\e-6n2-ps\"
Case \"ieg1\"
net.AddWindowsPrinterConnection \"\\\\print1\\e-6s1-ps\"
WshNetwork.SetDefaultPrinter \"\\\\print1\\e-6s1-ps\"
Case \"iem4\"
net.AddWindowsPrinterConnection \"\\\\print1\\E-CVS-HOLDING-PS\"
WshNetwork.SetDefaultPrinter \"\\\\print1\\E-CVS-HOLDING-PS\"
Case \"98ic\"
net.AddWindowsPrinterConnection \"\\\\print1\\ec3-frtdsk-mfd-ps\"
WshNetwork.SetDefaultPrinter \"\\\\print1\\ec3-frtdsk-mfd-ps\"
Case \"ido0\"
net.AddWindowsPrinterConnection \"\\\\print1\\ec4-frtdsk-ps\"
WshNetwork.SetDefaultPrinter \"\\\\print1\\ec4-frtdsk-ps\"
Case \"i0ic\"
net.AddWindowsPrinterConnection \"\\\\print1\\ec5-frtdsk-ps\"
WshNetwork.SetDefaultPrinter \"\\\\print1\\ec5-frtdsk-ps\"
Case \"k4ic\"
net.AddWindowsPrinterConnection \"\\\\print1\\ec6-frtdsk-ps\"
WshNetwork.SetDefaultPrinter \"\\\\print1\\ec6-frtdsk-ps\"
Case \"k0ig\"
net.AddWindowsPrinterConnection \"\\\\print1\\ec6-nursery-ps\"
WshNetwork.SetDefaultPrinter \"\\\\print1\\ec6-nursery-ps\"
Case \"i4ic\"
net.AddWindowsPrinterConnection \"\\\\print1\\ec5-nursery-ps\"
WshNetwork.SetDefaultPrinter \"\\\\print1\\ec5-nursery-ps\"
Case \"94ic\"
net.AddWindowsPrinterConnection \"\\\\print1\\EC2-PEDS1-MFD-PS\"
WshNetwork.SetDefaultPrinter \"\\\\print1\\EC2-PEDS1-MFD-PS\"
Case \"96ic\"
net.AddWindowsPrinterConnection \"\\\\print1\\EC2-PEDS2-PS\"
WshNetwork.SetDefaultPrinter \"\\\\print1\\EC2-PEDS2-PS\"
Case \"70vl\"
net.AddWindowsPrinterConnection \"\\\\print1\\EC2-WMNSERV2-PS\"
WshNetwork.SetDefaultPrinter \"\\\\print1\\EC2-WMNSERV2-PS\"
Case \"52it\"
net.AddWindowsPrinterConnection \"\\\\print1\\EC2-WMNSERV1-MFD-PS\"
WshNetwork.SetDefaultPrinter \"\\\\print1\\EC2-WMNSERV1-MFD-PS\"
Case \"ied4\"
net.AddWindowsPrinterConnection \"\\\\print1\\7east1-ps\"
WshNetwork.SetDefaultPrinter \"\\\\print1\\7east1-ps\"
Case \"ied7\"
net.AddWindowsPrinterConnection \"\\\\print1\\e-7n1-ps\"
WshNetwork.SetDefaultPrinter \"\\\\print1\\e-7n1-ps\"
Case \"ief0\"
net.AddWindowsPrinterConnection \"\\\\print1\\e-7s1-ps\"
WshNetwork.SetDefaultPrinter \"\\\\print1\\e-7s1-ps\"
Case \"a2ic\"
net.AddWindowsPrinterConnection \"\\\\print1\\e-7w1-ps\"
WshNetwork.SetDefaultPrinter \"\\\\print1\\e-7w1-ps\"
Case \"70tx\"
net.AddWindowsPrinterConnection \"\\\\print1\\w-cps-nurst1-ps\"
WshNetwork.SetDefaultPrinter \"\\\\print1\\w-cps-nurst1-ps\"
Case \"4m6n\"
net.AddWindowsPrinterConnection \"\\\\print1\\w-adup-nurst1-ps\"
WshNetwork.SetDefaultPrinter \"\\\\print1\\w-adup-nurst1-ps\"
Case \"4m5h\"
net.AddWindowsPrinterConnection \"\\\\print1\\w-neuro-nurs1-ps\"
WshNetwork.SetDefaultPrinter \"\\\\print1\\w-neuro-nurs1-ps\"
Case \"4m5i\"
net.AddWindowsPrinterConnection \"\\\\print1\\w-neuro-nurs2-ps\"
WshNetwork.SetDefaultPrinter \"\\\\print1\\w-neuro-nurs2-ps\"
Case \"ei38\"
net.AddWindowsPrinterConnection \"\\\\print1\\w-suro-nurs1-ps\"
WshNetwork.SetDefaultPrinter \"\\\\print1\\w-suro-nurs1-ps\"
Case \"ei39\"
net.AddWindowsPrinterConnection \"\\\\print1\\w-suro-nurs2-ps\"
WshNetwork.SetDefaultPrinter \"\\\\print1\\w-suro-nurs2-ps\"
Case \"n1gj\"
net.AddWindowsPrinterConnection \"\\\\print1\\w-orth-nurs1-ps\"
WshNetwork.SetDefaultPrinter \"\\\\print1\\w-orth-nurs1-ps\"
Case \"n2gj\"
net.AddWindowsPrinterConnection \"\\\\print1\\w-orth-nurs2-ps\"
WshNetwork.SetDefaultPrinter \"\\\\print1\\w-orth-nurs2-ps\"
Case \"j6gj\"
net.AddWindowsPrinterConnection \"\\\\print1\\w-reha-nurs2-ps\"
WshNetwork.SetDefaultPrinter \"\\\\print1\\w-reha-nurs2-ps\"
Case \"n0gj\"
net.AddWindowsPrinterConnection \"\\\\print1\\w-reha-nurs1-ps\"
WshNetwork.SetDefaultPrinter \"\\\\print1\\w-reha-nurs1-ps\"
Case \"7jv4\"
net.AddWindowsPrinterConnection \"\\\\print1\\w-reha-nurs3-ps\"
WshNetwork.SetDefaultPrinter \"\\\\print1\\w-reha-nurs3-ps\"
Case \"c8ic\"
net.AddWindowsPrinterConnection \"\\\\print1\\w-cc-nurs1-ps\"
WshNetwork.SetDefaultPrinter \"\\\\print1\\w-cc-nurs1-ps\"
Case \"g0ic\"
net.AddWindowsPrinterConnection \"\\\\print1\\w-cc-nurs2-ps\"
WshNetwork.SetDefaultPrinter \"\\\\print1\\w-cc-nurs2-ps\"
Case \"4m1g\"
net.AddWindowsPrinterConnection \"\\\\print1\\w-cc-nurs3-ps\"
WshNetwork.SetDefaultPrinter \"\\\\print1\\w-cc-nurs3-ps\"
Case \"70tq\"
net.AddWindowsPrinterConnection \"\\\\print1\\w-adol-nurst1-ps\"
WshNetwork.SetDefaultPrinter \"\\\\print1\\w-adol-nurst1-ps\"
Case \"4m6q\"
net.AddWindowsPrinterConnection \"\\\\print1\\w-afd-nurstn1-ps\"
WshNetwork.SetDefaultPrinter \"\\\\print1\\w-afd-nurstn1-ps\"
Case \"14it\"
net.AddWindowsPrinterConnection \"\\\\print1\\w-smh-nurst1-ps\"
WshNetwork.SetDefaultPrinter \"\\\\print1\\w-smh-nurst1-ps\"
Case \"4m5s\"
net.AddWindowsPrinterConnection \"\\\\print1\\ac_hp4050_ps\"
WshNetwork.SetDefaultPrinter \"\\\\print1\\ac_hp4050_ps\"
Case \"4m1p\"
net.AddWindowsPrinterConnection \"\\\\print1\\w-actr-hp4kt-ps\"
WshNetwork.SetDefaultPrinter \"\\\\print1\\w-actr-hp4kt-ps\"
Case \"d8gj\"
net.AddWindowsPrinterConnection \"\\\\print1\\W-INDC-HP4KT-PS\"
WshNetwork.SetDefaultPrinter \"\\\\print1\\W-INDC-HP4KT-PS\"
Case \"iei9\"
net.AddWindowsPrinterConnection \"\\\\print1\\e-5woutpt-ps\"
WshNetwork.SetDefaultPrinter \"\\\\print1\\e-5woutpt-ps\"
Case \"e6ir\"
net.AddWindowsPrinterConnection \"\\\\print1\\w-mh-stafstn1-ps\"
WshNetwork.SetDefaultPrinter \"\\\\print1\\w-mh-stafstn1-ps\"
Case \"l7ir\"
net.AddWindowsPrinterConnection \"\\\\print1\\w-ops-nursta1-ps\"
WshNetwork.SetDefaultPrinter \"\\\\print1\\w-ops-nursta1-ps\"
Case \"iej5\"
net.AddWindowsPrinterConnection \"\\\\print1\\e-ops1-ps\"
WshNetwork.SetDefaultPrinter \"\\\\print1\\e-ops1-ps\"
Case \"ij99\"
net.AddWindowsPrinterConnection \"\\\\print1\\E-SURG-AMADMT-PS\"
WshNetwork.SetDefaultPrinter \"\\\\print1\\E-SURG-AMADMT-PS\"
Case \"ijc5\"
net.AddWindowsPrinterConnection \"\\\\print1\\ep-bhilab-mfd-ps\"
WshNetwork.SetDefaultPrinter \"\\\\print1\\ep-bhilab-mfd-ps\"
Case \"70rq\"
net.AddWindowsPrinterConnection \"\\\\print1\\w-ns-fcu-ps\"
WshNetwork.SetDefaultPrinter \"\\\\print1\\w-ns-fcu-ps\"
Case \"f6in\"
net.AddWindowsPrinterConnection \"\\\\print1\\e-3e-cath-ps\"
WshNetwork.SetDefaultPrinter \"\\\\print1\\e-3e-cath-ps\"
Case \"f5in\"
net.AddWindowsPrinterConnection \"\\\\print1\\e-3w-ptr1-ps\"
WshNetwork.SetDefaultPrinter \"\\\\print1\\e-3w-ptr1-ps\"
Case \"ijh4\"
net.AddWindowsPrinterConnection \"\\\\print1\\e-gi1-ps\"
WshNetwork.SetDefaultPrinter \"\\\\print1\\e-gi1-ps\"
Case \"ijj1\"
net.AddWindowsPrinterConnection \"\\\\print1\\e-3e-teemfd-ps\"
WshNetwork.SetDefaultPrinter \"\\\\print1\\e-3e-teemfd-ps\"
Case \"id17\"
net.AddWindowsPrinterConnection \"\\\\print1\\e-gi1-ps\"
WshNetwork.SetDefaultPrinter \"\\\\print1\\e-gi1-ps\"
Case \"f9in\"
net.AddWindowsPrinterConnection \"\\\\print1\\e-4s-frtptr1-ps\"
WshNetwork.SetDefaultPrinter \"\\\\print1\\e-4s-frtptr1-ps\"
Case \"k4ig\"
net.AddWindowsPrinterConnection \"\\\\print1\\E-4N-FRTDSK-PS\"
WshNetwork.SetDefaultPrinter \"\\\\print1\\E-4N-FRTDSK-PS\"
Case \"if99\"
net.AddWindowsPrinterConnection \"\\\\print1\\E-SURG-AMADMT-PS\"
WshNetwork.SetDefaultPrinter \"\\\\print1\\E-SURG-AMADMT-PS\"
End Select
Else
Wscript.Echo \"Error: No Parm file available. Unable to Add Printer!!!\"
End If
\' ******************************************************************************
\' Execute Citrix PNAGENT FastLaunch,but first wait until the printer is mapped
\' or until we give up.
\' ******************************************************************************
const HKEY_CURRENT_USER = &H80000001
Set oReg=Getobject(\"winmgmts:{impersonationLevel=impersonate}! \\\\.\\root\\default:StdRegProv\")
For Counter = 1 to 30
strKeyPath = \"Software\\Microsoft\\Windows NT\\CurrentVersion\\Windows\"
oReg.GetStringValue HKEY_CURRENT_USER,\"Device\",strValue
\' if GT 0 then \\\\print1 Found in String and exit waiting for it.
If (InStr(1,strValue,\"\\\\print1\",1) > 0) then
Exit For
End If
wscript.sleep(1000)
Next
exestr = chr(34) & \"C:\\Program Files\\Citrix\\ICA Client\\pnagent.exe\" & chr(34) & \" /CitrixShortcut: (3) /QLaunch \" & chr(34) & \"BryanLGH-VDI:FastLaunch\" & chr(34)
\'Oshell.Run exestr,FALSE
解决方法
我将研究使用Intranet门户网站安装打印机的HTA或脚本,因为它们使您可以借助启发法来最好地确定VB脚本是否可行。显然,与不支持它的操作系统上运行的VBScript将会断开连接。
您可能能够利用浏览器功能来确定操作系统和浏览器客户端...,然后基于该功能利用适当的脚本来提供最终用户。例如,您可以将整个VB脚本包装到一个HTA文档中,该文档将仅交付给Windows客户端,并且它将直接从Web服务器hta文档运行客户端的vb代码,并且客户端将不会在意差异,因为Intranet HTA文件被认为是安全的。
您需要研究其他客户端的一些AppleScript或一些通用的PHP代码,以使这些数据可供最终用户在Windows的OS替代品上执行脚本。
另一种选择是运行在每个客户端上运行的java编码小程序。.我在其他公司已经看到了这一点。他们在其VDI中利用了相同类型的功能。没有自动打印机安装...最终用户根据他们的位置选择打印机,通常在他们用来选择脚本的浏览器中有办公室的地理地图。 Web代码为客户端决定哪种脚本适合在客户端系统上安装该特定打印机。
希望有帮助! :)
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。