VBScript and automatic printer connection Unconnection

  • Thread starter Thread starter Stefan Kostet
  • Start date Start date
S

Stefan Kostet

Hellow
I have build a VBScript that takes away all printer
connection in Windows 2003 AD, that the user dont have
access to. it working fine in Windows XP clients, but not
in Windows 2000 TS server. I have uppgrade VBScript
enginee to V5.6.0.8825 but no results. The script look
like this..

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer
& "\root\cimv2")
Set colInstalledPrinters = objWMIService.ExecQuery _
("SELECT * FROM Win32_Printer WHERE PrinterStatus =
1" _
& "OR PrinterStatus = 2")
If colInstalledPrinters.Count = 0 Then
Else
For Each objPrinter in colInstalledPrinters
Set objNetwork = CreateObject("Wscript.Network")
objNetwork.RemovePrinterConnection objprinter.Name
Next
End If
 
Hi Stefan,

Thanks for your posting here.

It appears that this is a Development related request and would best be
address in the Developer newsgroups. I have provided the link below:

<<http://msdn.microsoft.com/newsgroups/default.asp>>

Or you may ask for developer support:

http://support.microsoft.com/directory/directory/phonepro.asp?sd=msdn

I believe that you can get informative suggestions there.

Have a nice day!

Regards,
Bob Qin
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security

====================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
====================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
From: "Stefan Kostet" <[email protected]>
Subject: VBScript and automatic printer connection Unconnection
Date: Wed, 13 Oct 2004 03:40:58 -0700
Newsgroups: microsoft.public.win2000.printing
Hellow
I have build a VBScript that takes away all printer
connection in Windows 2003 AD, that the user dont have
access to. it working fine in Windows XP clients, but not
in Windows 2000 TS server. I have uppgrade VBScript
enginee to V5.6.0.8825 but no results. The script look
like this..

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer
& "\root\cimv2")
Set colInstalledPrinters = objWMIService.ExecQuery _
("SELECT * FROM Win32_Printer WHERE PrinterStatus =
1" _
& "OR PrinterStatus = 2")
If colInstalledPrinters.Count = 0 Then
Else
For Each objPrinter in colInstalledPrinters
Set objNetwork = CreateObject("Wscript.Network")
objNetwork.RemovePrinterConnection objprinter.Name
Next
End If
 
Back
Top