Question

Locked

mapping a printer vb script (premission denied)

By m-6rom ·
hi,
I have 30 printers in my company,
If I try to connect winxp share printer it's work fine, bat if I try to connect a win98 share printer I get "premission denied"

this is the script:

strcomputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

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

For Each objPrinter in colInstalledPrinters
If "\\" = Left( objPrinter.ServerName, 2 ) Then
objPrinter.Delete_
Else
end if
next


Set WSHNetwork = CreateObject("WScript.Network")

'List of printers to connect
WSHNetwork.AddWindowsPrinterConnection "\\10.20.0.118\hp"
WshNetwork.SetDefaultPrinter "\\10.20.0.118\hp"

This conversation is currently closed to new comments.

1 total post (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Collapse -

READ THIS...

by cyrusrynlee In reply to mapping a printer vb scri ...

- Try to install the latest version of wsh/vbscript on your win98 workstation.

- Many WMI commands don't work/are not supported in win98 versions. Check WMI classes library if the object you're trying to use can be run on win98 OS.

- in a domain setup, you must be the administrator of that domain (or try to add yourself in the local admin group). In a workgroup setup, you need to add/create yourself as a local administrator on each of the clients participating in the workgroup.

- Permission denied messages usually means you dont have access to that resource. Your script needs to have administrator access to execute its instructions properly.

Back to Networks Forum
1 total post (Page 1 of 1)  

Related Discussions

Related Forums