Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB won't delete printers?? (as a normal user)

Status
Not open for further replies.

bran2235

IS-IT--Management
Feb 13, 2002
703
0
0
US
Hi all,
Not sure if this is the best place but here's my issue (if you can help!)...

I have a Win2003 SP2 Server with Citrix 4.5 installed (terminal services).

ALL I WANT TO DO IS LET ME VB (logon script) delete everyone's network attached printers at logon!!

Here's my code:
=========================
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
==========================

It works as an admin but not as a user (as it's running at logon for my test user).

Error: Generic Failure
Code: 80041001
Source: SWbemObjectEx

Please help!
Thank yoU!
Brandon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top