Jump to content

Recommended Posts

Posted

Hi all,

 

Hope someone can help with this as its driving me crazy.

 

We have a Windows 7 vanilla network mapping printers via a logon script, even though it’s stated in the script to remove all printers before it adds another it only works when we manually run it, seems to half run when used as a logon script.

 

For i = 0 to Printers.Count - 1 Step 2

If Left(ucase(Printers.Item(i+1)),2) = "\\" Then

' WScript.Echo Printers.Item(i+1)

WSHNetwork.RemovePrinterConnection Printers.Item(i+1)

End IF

Next

 

csname = left(cname,3)

'msgbox csname

mylprinter = ""

Select Case csname

case "LRC", "LRS"

myprinter = “\\printserver\LRC-Kyocera”

 

So after the users log on to a few different areas they have a bloated choice of printers but the scripted printer for the area is defaulted.

 

The printers are stored in the profiles, if we reset them printers disappear but they start collecting again. We have followed the best practices for printers and GPO profiles and redirections.

 

Thinking about using the GPO way via users as it allows you to add a remove all option followed by add printer, but am expecting that to accumulate printers in the same way.

 

Any help appreciated.

 

Thanks

Posted

Hi. This is probably too late, but I'd definitely recommend giving GPO printer deployment a go. We have Kyocera printers and were having weird things happen with log on scripts. I'm still not sure why they weren't happy, but I changed to GPO everything's working now, so it's not top of my list to work it out.

 

There's another post on here asking whether we'd recommend Kyocera printers and quite a few people have mentioned strange goings on.

 

Good luck

  • Thanks 1
Posted

I use the following code in our VB logon script with no issues whatsoever in Windows 7. As far as your own script only working if you run by hand might have something to do with UAC though.

 

Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
Set colInstalledPrinters = objWMIService.ExecQuery("Select * from Win32_Printer",,48)
	
On Error Resume Next
	
For Each objPrinter in colInstalledPrinters
	objNetwork.RemovePrinterConnection objPrinter.Name
Next

If Error <> 0 Then
	'Just catch the error, moving on
Else
	'Nothing to see here folks, move along.
End If

  • Thanks 1
Posted

Thanks, ill make a 2nd script with the above in and do some testing, UAC has been disabled as it blocked software deployment so has the firewall and sleep\hibernate.

 

I am going to start some testing w gpo printers and un-linking student based gpos to see if i have inadvertently blocked removing printers or something daft like that.

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...