mapping a printer vb script (premission denied)

By m-6rom ·
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
end if

Set WSHNetwork = CreateObject("WScript.Network")

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

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Answers

Collapse -


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.

Related Discussions

Related Forums