Jump to content

Recommended Posts

Posted

Feel like i need a "geek" signal. lol

 

Right, trying to get printers to work at hogwarts. Printers installed and shared on Curricsvr2. I was convinced this worked the other day but the netbooks dont seem to want to pick up the printers on logon today.

 

It's the bottom set im interested in.

 

on error resume next

Set WshNetwork = CreateObject("WScript.Network")

Dim Compname

Compname = WSHNetwork.ComputerName

WshNetwork.RemovePrinterConnection "\\curricsvr1\STAFF-ROOM", True, True
WshNetwork.RemovePrinterConnection "\\curricsvr1\TASROOM", True, True
WshNetwork.RemovePrinterConnection "\\curricsvr1\LIBRARY", True, True
WshNetwork.RemovePrinterConnection "\\curricsvr1\JUNIOR-SUITE", True, True
WshNetwork.RemovePrinterConnection "\\curricsvr1\INFANT-SUITE", True, True
WshNetwork.RemovePrinterConnection "\\curricsvr1\FOUNDATION", True, True
WshNetwork.RemovePrinterConnection "\\curricsvr1\INFANT-OFFICE", True, True
WshNetwork.RemovePrinterConnection "\\curricsvr2\STAFF", True, True
WshNetwork.RemovePrinterConnection "\\curricsvr2\STUDENT", True, True	

if left(compname,8) = "JNRCLASS" then 

PrinterPath = "\\curricsvr1\JUNIOR_SUITE"
PrinterPath2 = "\\curricsvr1\INFANT_LIBRARY"
PrinterPath3 = "\\curricsvr1\MIDDLE_STOCK_ROOM"
PrinterPath4 = "\\curricsvr1\STAFF-ROOM"

 	WshNetwork.AddwindowsPrinterConnection PrinterPath
 	WshNetwork.AddwindowsPrinterConnection PrinterPath2
WshNetwork.AddwindowsPrinterConnection PrinterPath3
WshNetwork.AddwindowsPrinterConnection PrinterPath4
WshNetwork.SetDefaultPrinter "\\curricsvr1\INFANT_LIBRARY"

end if 


if left(compname,8) = "INFCLASS" then 

PrinterPath = "\\curricsvr1\INFANT_SUITE"
PrinterPath2 = "\\curricsvr1\INFANT_LIBRARY"
PrinterPath3 = "\\curricsvr1\FOUNDATION_STAGE"
PrinterPath4 = "\\curricsvr1\STAFF-ROOM"
 	WshNetwork.AddwindowsPrinterConnection PrinterPath
 	WshNetwork.AddwindowsPrinterConnection PrinterPath2
WshNetwork.AddwindowsPrinterConnection PrinterPath3
WshNetwork.AddwindowsPrinterConnection PrinterPath4
WshNetwork.SetDefaultPrinter "\\curricsvr1\INFANT_LIBRARY"

end if

if left(compname,4) = "JUNS" then 

PrinterPath = "\\curricsvr1\INFANT_SUITE"
PrinterPath2 = "\\curricsvr1\INFANT_LIBRARY"
PrinterPath3 = "\\curricsvr1\MIDDLE_STOCK_ROOM"
PrinterPath4 = "\\curricsvr1\STAFF-ROOM"
 	WshNetwork.AddwindowsPrinterConnection PrinterPath
 	WshNetwork.AddwindowsPrinterConnection PrinterPath2
WshNetwork.AddwindowsPrinterConnection PrinterPath3
WshNetwork.AddwindowsPrinterConnection PrinterPath4
WshNetwork.SetDefaultPrinter "\\curricsvr1\INFANT_SUITE"

end if


if left(compname,4) = "INFS" then 

PrinterPath = "\\curricsvr1\INFANT_SUITE"
PrinterPath2 = "\\curricsvr1\INFANT_LIBRARY"
PrinterPath3 = "\\curricsvr1\STAFF-ROOM"
 	WshNetwork.AddwindowsPrinterConnection PrinterPath
 	WshNetwork.AddwindowsPrinterConnection PrinterPath2
WshNetwork.AddwindowsPrinterConnection PrinterPath3
WshNetwork.SetDefaultPrinter "\\curricsvr1\INFANT_SUITE"


end if

if left(compname,7) = "LIBRARY" then

PrinterPath =  "\\curricsvr1\INFANT_LIBRARY"
PrinterPath2 = "\\curricsvr1\JUNIOR_SUITE"
PrinterPath3 = "\\curricsvr1\INFANT_SUITE"
PrinterPath4 = "\\curricsvr1\STAFF-ROOM"
WshNetwork.AddwindowsPrinterConnection PrinterPath
WshNetwork.AddwindowsPrinterConnection PrinterPath2	
WshNetwork.AddwindowsPrinterConnection PrinterPath3
WshNetwork.AddwindowsPrinterConnection PrinterPath4
wshNetwork.SetDefaultPrinter "\\curricsvr1\INFANT_LIBRARY"

end if


if left(compname,6) = "JNRSEN" then 

PrinterPath = "\\curricsvr1\MIDDLE_STOCK_ROOM"
PrinterPath2 = "\\curricsvr1\JUNIOR_SUITE"
PrinterPath3 = "\\curricsvr1\INFANT_LIBRARY"
PrinterPath4 = "\\curricsvr1\STAFF-ROOM"
 	WshNetwork.AddwindowsPrinterConnection PrinterPath
 	WshNetwork.AddwindowsPrinterConnection PrinterPath2
WshNetwork.AddwindowsPrinterConnection PrinterPath3
WshNetwork.AddwindowsPrinterConnection PrinterPath4
WshNetwork.SetDefaultPrinter "\\curricsvr1\MIDDLE_STOCK_ROOM"

end if

if left(compname,3) = "MSR" then 

PrinterPath = "\\curricsvr1\JUNIOR_SUITE"
PrinterPath2 = "\\curricsvr1\INFANT_LIBRARY"
PrinterPath3 = "\\curricsvr1\MIDDLE_STOCK_ROOM"
PrinterPath4 = "\\curricsvr1\STAFF-ROOM"
 	WshNetwork.AddwindowsPrinterConnection PrinterPath
 	WshNetwork.AddwindowsPrinterConnection PrinterPath2
WshNetwork.AddwindowsPrinterConnection PrinterPath3
WshNetwork.AddwindowsPrinterConnection PrinterPath4
WshNetwork.SetDefaultPrinter "\\curricsvr1\MIDDLE_STOCK_ROOM"

end if

if left(compname,7) = "NETBOOK" then 

PrinterPath = "\\curricsvr2\STUDENT"
PrinterPath2 = "\\curricsvr2\STAFF"
 	WshNetwork.AddwindowsPrinterConnection PrinterPath
 	WshNetwork.AddwindowsPrinterConnection PrinterPath2
WshNetwork.SetDefaultPrinter "\\curricsvr2\STAFF"
end if

 

whats obvious that ive missed!? lol

 

They seem to be defaulting to the "juns" one as well which is no good as they're not on this site!

 

Help..

Posted

If there is a printer driver issue, would that cause this?

 

The printers are installed quite happily on the server i can print from them...but if i manually add a printer i get told the drivers are incorrect....

 

This is a 2K8 server and XP pro clients...

Posted

Dunno, but below is what I use to remove all connections rather than have to explicitly list them like you have.

 


'Remove ALL old printers
'Enumerate all printers first, after that you can select the printers you want by performing some string checks
Set WSHPrinters = WNet.EnumPrinterConnections
For LOOP_COUNTER = 0 To WSHPrinters.Count - 1 Step 2
'To remove only networked printers use this If Statement
   If Left(WSHPrinters.Item(LOOP_COUNTER +1),2) = "\\" Then
     WNet.RemovePrinterConnection WSHPrinters.Item(LOOP_COUNTER +1),True,True
   End If
'To remove all printers incuding LOCAL printers use this statement and comment out the If Statement above
'WSHNetwork.RemovePrinterConnection WSHPrinters.Item(LOOP_COUNTER +1),True,True
Next
'end delete existing printers

 

Which is helpfull if you add more printers in the future

 

Ben

Posted (edited)

If you want to use vbs to do this then I would defo put a pause in the script so that it gives the machine time to logon before trying to add printer connections etc. Not sure if it will help any but may be worth editing the below line :

 

 

Compname = Trim(WSHNetwork.ComputerName)

 

Also does Compname return the name as uppercase ?

Edited by mac_shinobi
Posted
Well that does make sense cus i havent. But these arent brand new printers, they are printers they used pre-fire just in new location so the clients should already have the drivers installed....or does it not work that way?
Posted
Ok, riddle me this.....it's only one of my netbook trolleys!! The other netbooks pick up the printers fine...

 

fair enough - in that case on the trolley of netbooks that are having issues - is this windows xp on them or what exactly ?

Posted

@Plexer wouldn't this be easier and more readable? It's a portion of our printer script which is run using our logon.bat file.

 

'On Error Resume Next


Call DelPrinterConnectionAll()

Function DelPrinterConnectionAll()

strComputer = "."

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Set colInstalledPrinters =  objWMIService.ExecQuery _
   ("Select * from Win32_Printer Where Network = TRUE")

For Each objPrinter in colInstalledPrinters
   objPrinter.Delete_
Next

End Function

Posted
I can almost guarantee its the atheros cards. My old place had the same make and model, had all sorts of issues, managed to get Toshiba to supply us with intel wifi antennae for free and we replaced them ourselves (with letters attesting to the warranty not being voided) and the issues we had went away. I think Atheros wifi is absolute poo.
  • Thanks 1
Posted

We've had issues with wireless getting bogged down before with netbook carts and have implemented a couple tweaks to alleviate the congestion a little.

 

1) If your wireless system is centrally managed, then disable the slower data rates. If all your devices are 802.11G or better, then flat out disable all the 802.11B data rates. You would be surprised how much faster this can make wireless when using entire cart of 30 netbooks for web browsing.

 

2) Enable "Always wait for the network at computer startup and logon" in GPO. It'll take a few more seconds to get to a logon prompt, but the system will wait for the wireless connection to associate instead of using cached credentials. This setting can be found in Computer Configuration\Administrative Templates\System/ Logon.

 

3) Tighten up the code in the VBS script as much as possible. The less code the client has to crunch the better. I would start by doing away with the separate if/end if statements for all the different computer names and go with If/ElseIF statements.

 

Good luck!

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 account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...