mullet_man Posted April 17, 2007 Posted April 17, 2007 Thanks Ric, At the moment I have around 6 rooms all setup great in the script. I have setup to the 3 letter inspect. I have two rooms one called RM2 (pcs called RM2-01 etc) and another called RM15 (pcs called RM15-01 etc) So the script picks it up ok, but in Science we have laptops named S-01 to S-30, so I cant use S- as that is 2 letters. And if I bring the inspect down to 2 letters it would pick up RM2 and RM15 as the same rooms? If I could use a split how would I put that in? I am very limited when it comes to scripting. Thanks and hope that makes more sense! Ste.
mullet_man Posted April 18, 2007 Posted April 18, 2007 Hi Ric, How would I implement the split?, looking at the script I would need to have two different inspects to help with the science laptops. Thanks in advance.
Geoff Posted April 18, 2007 Posted April 18, 2007 Well you could nest it in the RM case Select Case (Left(computerName, 1)) Case "r" Select Case (Left(computerName, 3) Case "rm1" 'RM15 stuff here Case "rm2" 'RM2 stuff here Case Else 'catch all for anything else called 'RXXXXX End Select Case "s" 'S- stuff here
mac_shinobi Posted April 18, 2007 Posted April 18, 2007 It would be something along the lines of : Dim x, strComputer x = split(strComputer,"-") Select Case x(0) '<-- change the value in between the brackets Case "RM01" wshnetwork.AddwindowsPrinterConnection Case "RM02" wshnetwork.AddwindowsPrinterConnection End Select if you change the value in between the brackets for x(0) or x(1) then it will return the characters before or after the split character which in this case is the hyphen because your computer names all have RM01-01 or RM15-02 or whatever which is a common character so we use the common character to split the string.
Andi Posted April 20, 2007 Posted April 20, 2007 Would this script work with Thinstation clients? They connect using the GUID that AD sets them, but presumably I can set their client name somewhere so that it reflects the room they are in? If that is the case then how would I run this script on a thinclient?
Geoff Posted April 23, 2007 Posted April 23, 2007 What are you using server side for your thinstation clients? Citrix? Terminal Server? Something else?
Ric_ Posted April 23, 2007 Author Posted April 23, 2007 Indeed it does work on ThinStation (as I use it on ThinStation). You need to give your machines sensible names in the thinstation.hosts file... something similar to this will do: # HOST MAC GROUPS COMMENTS #donald 003103014152 it_kb hi_res # Donald Ducks Computer RM1-PC01 0050044716AB RM1-PC02 0007E996B6B6 RM2-PC69 000BDB56E8A3 You then just run the script as a login script and Bob's your uncle
Geoff Posted April 23, 2007 Posted April 23, 2007 Are your thinstations pushing out unique %CLIENTNAME%'s?
Andi Posted April 23, 2007 Posted April 23, 2007 I see, thanks Ric. Now this is probably a stupid question (it's Monday) but do I run it in the usual user login script? Won't this then run on all stations slowing the logon? Geoff, I believe they are yes, but I will need to check first. I apologise if I'm being slow
Andi Posted April 23, 2007 Posted April 23, 2007 Do you mean to set it in the Environment tab of the Terminal Server Config?
Andi Posted April 23, 2007 Posted April 23, 2007 Actually scratch that, I've just found this page for the login script section. http://support.microsoft.com/kb/195461
Andi Posted April 23, 2007 Posted April 23, 2007 Sorry guys, how can I manually set my TS clients ID? Currently it's picking the MAC address. I've tried manually creating a computer account in AD with the correct GUID but it's not working.
Andi Posted April 23, 2007 Posted April 23, 2007 Ah yes, I see. Thanks for your help. I'll be back I'm sure
Andi Posted April 24, 2007 Posted April 24, 2007 This is all looking good so far, however the script isn't running at logon. I have added the vbs script to %systemroot%\system32 and told the registry to call it as in the Microsoft link above. However, it isn't running. Any ideas?
Geoff Posted April 24, 2007 Posted April 24, 2007 You must run the script at machine startup and user login otherwise the printer drivers are not installed correctly (due to users not having enough permissions to load printer drivers).
Andi Posted April 24, 2007 Posted April 24, 2007 How can I run the script at machine startup on a thinclient?
Andi Posted April 24, 2007 Posted April 24, 2007 Sorry Geoff, you've confused me. I have to run the script to connect the printers at the terminal server startup?? This hasn't been mentioned anywhere else in this thread.
Ric_ Posted April 24, 2007 Author Posted April 24, 2007 I think that Geoff has muddied the water slightly... You need to have ALL the printer drivers installed on your terminal servers. You can do this with a script such as the following: ' Startup script to add network printer drivers at startup ' Author: Ric Charlton, 11/04/07 ' Declare variables and enumerate existing printer connections On Error Resume Next Set WshShell = WScript.CreateObject("WScript.Shell") Set WshNetwork = WScript.CreateObject("WScript.Network") Set oPrinters = WshNetwork.EnumPrinterConnections ' Delete existing connections to network printers For i = 0 to oPrinters.Count - 1 Step 2 On Error Resume Next if Left(oPrinters.Item(i), 3) <> "lpt" And Left(oPrinters.Item(i), 3) <> "usb" then WshNetwork.RemovePrinterConnection oPrinters.Item(i+1), true, true else WScript.Echo "No network printers found" end if Next ' Add printer connections ' Variable to select print server Dim printServer printServer = "debian-02" WshNetwork.AddWindowsPrinterConnection "\\" & printServer & "\PRINTER-01" WshNetwork.AddWindowsPrinterConnection "\\" & printServer & "\PRINTER-02" ' Add more printers here by copying above lines ' Delete connections to network printers oPrinters = WshNetwork.EnumPrinterConnections For i = 0 to oPrinters.Count - 1 Step 2 On Error Resume Next if Left(oPrinters.Item(i), 3) <> "lpt" And Left(oPrinters.Item(i), 3) <> "usb" then WshNetwork.RemovePrinterConnection oPrinters.Item(i+1), true, true else WScript.Echo "No network printers found" end if Next If you run the above script at startup, it will ensure that all your printers are always available to the computers since users generally do not have sufficient priviledges to install printer drivers. You then need to run the printers.vbs script as a login script (best called from a GPO... User Configuration -> Windows Settings -> Scripts). No changes need to be made to your thin client devices (except giving them meaningful names). BTW Andi.... could you please add your location to your profile?
Geoff Posted April 24, 2007 Posted April 24, 2007 Yes, otherwise the Terminal Server will not have the drivers for the printers installed correctly. Thus they don't get setup correctly when the users login. Thus no/missing printers. See these prior threads on the subject: http://www.edugeek.net/index.php?name=Forums&file=viewtopic&t=5736 http://www.edugeek.net/index.php?name=Forums&file=viewtopic&t=3653 http://www.edugeek.net/index.php?name=Forums&file=viewtopic&t=445
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now