Link to home
Start Free TrialLog in
Avatar of kinji5
kinji5

asked on

Permission denied when adding Printer using VBS script in Users Logon via Group Policy

I am trying to deploy printers via Group Policy on Windows 2003 Server to Windows XP Pro client on the same domain.  I call the printer.vbs script from a logon.bat file in the User Configuration -> Windows Settings -> Scripts -> Logon
The script will launch but I get a "Permission Denied" on Line 5.
If I log on as domain admin on the client and run the script it will map the printers. Then I go back and log on as user it will map.  Is there a printer policy I need to enable/disable?

Thanks

/------------Begin Script-----------/
Dim objNetwork
Dim strUNCPrinter01
strUNCPrinter01 = "\\ServerIP\PrinterShareName"
Set objNetwork = CreateObject("WScript.Network")
objNetwork.AddWindowsPrinterConnection strUNCPrinter01
objNetwork.SetDefaultPrinter strUNCPrinter01
WScript.Echo "Check the Printers folder for : " & strUNCPrinter01
WScript.Quit
/------------End Script-------------/

Avatar of Jason Watkins
Jason Watkins
Flag of United States of America image

Hi,

Try adding the domain users group to the local print operators group (XP).

/F
Avatar of kinji5
kinji5

ASKER

Would I have to do this from individual machines or is it a policy I can set from the server?
No,

Open up your domain security policy, or default domain GPO.
Navigate to:  Computer Configuration\Windows Settings\Security Settings\Restricted Groups
Add the domain users group as a member of the print operators group.
GPUpdate

/F
Avatar of kinji5

ASKER

/F

I tried your suggestion fo "Try adding the domain users group to the local print operators group (XP)."

I am still getting an error.

some one recommended me to try use.

As an alternative to the the vbscript you posted check out prnmngr.vbs in the system32 folder

To map printer:

cscript "%SYSTEMROOT%\system32\prnmngr.vbs" -ac -p "\\SERVERNAME\PRINTERSHARE"


To make the printer default:

cscript "%SYSTEMROOT%\system32\prnmngr.vbs" -t -p "\\SERVERNAME\PRINTERSHARE"

Are you still game for some help? I know it's been a while for a response.
Avatar of kinji5

ASKER

Yes, i still need assistance. I am still getting permission denied.
Let me recruit someone better at a script than I am.
Avatar of Netman66
User's can't run wscript or cscript.

You can try using Printui.dll to do this:

rundll32 printui.dll PrintUIEntry /in /n\\machine\printer
ASKER CERTIFIED SOLUTION
Avatar of Netman66
Netman66
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks Netman( |:^} >