We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

Sharing printer on Domain

pawankk
pawankk asked
on
Medium Priority
1,159 Views
Last Modified: 2008-03-03
I have creted a domain in my network and restricted users with GPO's to acess desktop, start menu and many commands i wanted to share the Network printer on printing server by default is there any option ..that the printer is isntalled automatically as user login through login script or throgh any policy kindly tell off.
waiting for reply
Comment
Watch Question

Commented:
If I understand you correctly, you wish to use a logon script to attach a network printer and set a defaut printer.  That is easily done by creating a group policy and using a vbscript.

Microsoft has alot of sample scripts for printers here: http://www.microsoft.com/technet/scriptcenter/scripts/default.mspx?mfr=true

Author

Commented:
is there any other way to install and make the printer default except group policy
yip, image all your installation.... :-0   ??

Author

Commented:
image installation how to image printer installed but how ??
install one machine and then image cast onto the next machine from the network. using a stiffy drive or flash as boot up over the LAN.

Commented:
There are lots of ways to attach to network printers, but the easiest way for the administrator to force it is to use Group Policy and a script.  You could create a shortcut on your desktop with the path: \\servername\printername and copy that onto other desktops and instruct users to double-click.  That will connect but not make it the default printer.

I would still go with a logon script in Group Policy.
Commented:
I would use a vbs script like this:

set WshNetwork=CreateObject ("Wscript.Network")
WshNetwork.AddWindowsPrinterConnection "\\servername\sharename"
WshNetwork.SetDefaultPrinter "\\servername\sharename"

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
this could be costly and needs to install a fixed print server - and this stops other network printer installations.... but if this is you intention then this is the way to go as from drawlin. its the best way.
I hav a network print server thats linked from a GPO to all machines on the domain..

Author

Commented:
aplona   & drawlin

I have tried these VBscripts for instaling printer  through a batch file as longon script. But all there is no result kindly tell me how to write these scirpts.

Commented:
Use the text in the examples and save them as a .vbs file.  When you assign the logon script, browse and take note of the folder that the "browse" starts in (E198FA.........)  It will be the SID for the OU that you are assigning the script to.

Let me back up.  You need to assign the script via group policy for an OU rather than in the user properties for the user.

Once you have identified the folder that you browsed for (\\DCserver\sysvol\E198FA....\users\scripts\logon )  Put the .vbs file in that directory, then while you are assigning a logon script for the Group policy for the OU point it to the .vbs file.  

I'm sorry, I don't have a AD server in front of me and I can't remember the path exactally, so you may have to drill down a bit deeper than \\DCserver\sysvol to find the folder with named for the SID of the OU that you are applying the script to.
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set objPrinter = objWMIService.Get("Win32_Printer").SpawnInstance_

objPrinter.DriverName = "HP LaserJet 4000 Series PS"
objPrinter.PortName   = "IP_169.254.110.160"
objPrinter.DeviceID   = "ScriptedPrinter"
objPrinter.Location = "USA/Redmond/Building 37/Room 114"
objPrinter.Network = True
objPrinter.Shared = True
objPrinter.ShareName = "ScriptedPrinter"
objPrinter.Put_

Author

Commented:
aplona  & Philstarfish

set WshNetwork=CreateObject ("Wscript.Network")
WshNetwork.AddWindowsPrinterConnection "\\192.168.0.100\HPBusine"
WshNetwork.AddWindowsPrinterConnection "\\192.168.0.100\SamsungM"
WshNetwork.SetDefaultPrinter "\\192.168.0.100\HPBusine"

the following error is occuring

line:4
char :1
error : The system cannot find the file specified
code: 8007000
source (null)

Commented:
try it without line 4,(remove the line with the set default printer) and see if it maps the printers.  This will give us a starting point.

Author

Commented:
printers are installed but no default printer is selected in the list but some time it give these error

line: 2
char: 1
error : overlapped I/O operation is in progress
code: 800703E5
source:null

aplona another question  want to map netwrok drive through scripting can it be possible i have used the following line will it work

WshNetwork.MapNetworkDrive "Z:", "\\192.168.0.100\transfer"

Commented:
yes that will work.  Thats the same liine I have always used.

Commented:
I don't know about that error though.  I have been using this script for years and never had problems.

Author

Commented:
aplona any solution ofr this error

Commented:
Does this happen on every computer?  If it does then try to recreate the printer

Author

Commented:
Aplona i have tried this batch file on other computer which ar not on domain only in workgroup

there is no error as such in those independent pc

and the pc on domain is giving error.

overlapped I/O operation is in progress

I think  some operation is processing while login script is processed can we pause  login script for ffew seconds or minutes and then execute it after few minutes ..wait or pause  any such command.

Commented:
Remove the script from the gpo and run the file after the person has already logged in and see if you still get the error.

Author

Commented:
Yah its not working i have tried it in without applying in GPO. But yet another intresting thing i saw it installs the printer but it does not make it default. i gave to discccontct the printer in log off script to ..but didnt succeded
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.