Gardinho Posted March 16, 2010 Posted March 16, 2010 Hi guys, I have recently ordered 30 new laptops. SMT would like me to install Windows 7 to see what people think of it. I have a Server 2003 Domain controller, so using group policy preferences and client side extensions in server 2008 is not really an option. Does anyone have an up-to-date vb script to map network printers in Windows 7? Many thanks, DGardner
LeMarchand Posted March 16, 2010 Posted March 16, 2010 Same setup as you (Server 2003 - as the LEA don't support 2008 yet!) and just put a load of W7 laptops out. Our standard VB script worked but (you knew it was coming...) there was some problem (with UAC?) that prevented the log on script running as it needed permission to install the drivers. I ran the script manually and allowed the drivers through and since then it's been fine. Anyway, your old script may work if the drivers are pre-installed (though as it was the second iteration of the image, it should have had them). I was wondering if a startup rather than log on script might do better, but with only 2x2.5 hours/week at that school and the fact that the teachers have been provided the laptops as "home work" machines (don't go there) I haven't made any further investigations.
sted Posted March 16, 2010 Posted March 16, 2010 if its a 2003 r2 then the print console there works nicely on win 7 all i use a vbs script for is to set default printer
SYNACK Posted March 16, 2010 Posted March 16, 2010 You can easily get rid of the UAC on adding printers with VBS scripts with a simple change to group policy even under server 2003 see here: http://www.edugeek.net/forums/windows-vista/22950-solution-mapping-printers-logon-scripts-vista-without-uac-interupting.html#post223322
lordasb Posted March 16, 2010 Posted March 16, 2010 ok how do you get that option on windows 2k3 active directory ? so my windows 7 machines get the right settings? i have point to print but limited number of options to just the standard ones listed in 2k3 non r2 thanks andy
lordasb Posted March 17, 2010 Posted March 17, 2010 been thinking on this over night and just testing a solution now will report back
srochford Posted March 17, 2010 Posted March 17, 2010 Hi guys, I have recently ordered 30 new laptops. SMT would like me to install Windows 7 to see what people think of it. I have a Server 2003 Domain controller, so using group policy preferences and client side extensions in server 2008 is not really an option. Oh yes it is :-) You don't need Server 2008 to use GPP - you just need server 2003. The confusion comes about because it wasn't introduced until Server 2008 and you can't manage it unless you've got at least one machine with Server 2008, Vista or Windows 7.
LeMarchand Posted March 17, 2010 Posted March 17, 2010 You can easily get rid of the UAC on adding printers with VBS scripts with a simple change to group policy even under server 2003 see here: http://www.edugeek.net/forums/windows-vista/22950-solution-mapping-printers-logon-scripts-vista-without-uac-interupting.html#post223322 User Configuration -> Policies -> Administrative Templates -> Control Panel -> Printers : Point and Print Restrictions Setting: Enabled In its Config Tab: Do not specify any servers to restrict Point and Print to so it will continue to work for any server without specifying every one Security Prompts: When Installing drivers for a new connection: -Do not show warning or elevation prompt -Show warning and elevation prompt When updating drivers for an existing connection: -Do not show warning or elevation prompt -Show warning and elevation prompt -Show warning only Do you need to install RSAT on the W7 machines? I get as far as finding the policy, but the bits in italics don't seem to be an option.
lordasb Posted March 17, 2010 Posted March 17, 2010 Do you need to install RSAT on the W7 machines? I get as far as finding the policy, but the bits in italics don't seem to be an option. you getting more along than me then - i have installed the rsat for windows 7 on a windows 7 machine and it till not connect to the server .
garethEds Posted March 17, 2010 Posted March 17, 2010 Here is the script we use - not for Windows 7 but for Windows XP. Try it. It was written by one of our LEA script gurus so I have left his name in. 'Name : addprinter.vbs 'Author : Matt Davies 'Date : 22/03/2006 'Description : - Used to add printers for a user ' - Used inconjunction with group policy at Workstation level so it runs per room ' - Needs to be run under "USER" Logon scripts Option Explicit Dim objNetwork 'declare the printer names - add as necessary Dim strUNCPrinter1 Dim strUNCPrinter2 'set the UNC path to the printers you want mapped - add as necessary strUNCPrinter1 = "[url="file://\\ygg-printers\2700-Cymraeg"]\\ygg-printers\2700-Cymraeg[/url]" strUNCPrinter2 = "[url="file://\\ygg-printers\5170-Cymraeg"]\\ygg-printers\5170-Cymraeg[/url]" Set objNetwork = CreateObject("WScript.Network") 'remove old printer(s) first 'for debugging comment out next line only on error resume next objNetwork.RemovePrinterConnection strUNCPrinter1 objNetwork.RemovePrinterConnection strUNCPrinter2 'Wait 3 seconds whilst windows removes the old printers wscript.sleep(3000) 'Add the printer to the computer - add as necessary objNetwork.AddWindowsPrinterConnection strUNCPrinter1 objNetwork.AddWindowsPrinterConnection strUNCPrinter2 ' Here is where we set the default printer - change if necessary objNetwork.SetDefaultPrinter strUNCPrinter1 'End the script Wscript.Quit
SYNACK Posted March 18, 2010 Posted March 18, 2010 I have updated my page here with more information required for Windows 7: http://www.edugeek.net/forums/windows-vista/22950-solution-mapping-printers-logon-scripts-vista-7-without-uac-interupting.html#post223322
lordasb Posted March 19, 2010 Posted March 19, 2010 just to add i have now resolved the issue with windows 7 i have stopped using vbs and moved to kix scripts to call the printers. i have uninstalled all the older drivers from my server for my HP products (laserjet 1200) was the one which was crashing out the print spooler on the windows 7 machine on attempting to install. i installed the HP universal pcl5/pcl6 driver on the machine which is now pulled to the windows 7 machine and it works fine. i do still have the pop up asking if i trust the printer driver i am installing but without changing to windows 2k3 r2 i dont have any way of changing that .
burgemaster Posted March 19, 2010 Posted March 19, 2010 deploy printers with group policy works perfectly. I think you need R2 if your running server 2003
Windy08 Posted April 20, 2010 Posted April 20, 2010 I have a similar problem. We have got 30 Win7 netbooks on a Server 2003 domain. My VB printer script works fine on the XP machines. On the 7 machines, my printers are mapped when logged on as admin but not when I log on as a user. Gpresult says the policy with the script in it "is applied", but the printers aren't mapped. I have got RSAT installed on the 7 machines and done the point to print restriction policy as described by SYNACK. I can install the printers when logged on as a user in the normal way, so the drivers are there and there aren't any restrictions.
SYNACK Posted April 20, 2010 Posted April 20, 2010 @Windy08, are you using a vbs or a bat file to map printers, I had issues with bat file based printer adding even with the restrictions turned off so had to use a VBS based one. Also are the Windows 7 machines 64bit and if so do you have 64bit drivers shared out on your print server for them to use?
Gardinho Posted April 20, 2010 Author Posted April 20, 2010 Cheers for the response everyone. I have actually just put XP on for now, until I upgrade the servers to 2008. I will defo use the info in the summer! Thanks again.
Windy08 Posted April 20, 2010 Posted April 20, 2010 SYNACK, I'm using vbs. The 7 machines are 32 bit. I got a call after I'd been tinkering with the 7 machines to say that nobody could print so I toddled off back to find that the print spooler service had stopped and the printers were no longer installed on the server. I got that back up and running by starting the service and reinstalling the printers, but when I tried to reinstall, it said the printer was already in use, so I created a new printer, and just as I'd finished installing it, the other 2 printers appeared in the printers folder as if by magic. Don't know what that was all about. Anyway, I dug deeper and found that staff (with roaming profiles) could also see the printers, but pupils (with mandatory profiles) couldn't, so it started to look like group policy issues when logging on as a user even though the printer script runs on an OU that contains computers and not users. I only work there for 2 hours twice a week so I will investigate more when I'm back in, but it seems to be heading towards a policy on the users OU that is stopping the script working. I will report back when I've found the culprit
mrbios Posted April 20, 2010 Posted April 20, 2010 When people use the group policy assigned printers are you using the server 2008 R2 route of deploying them in GP or creating the policy manually with a loopback processing policy to assign a shared printer it to a machine OU?
ricki Posted April 21, 2010 Posted April 21, 2010 deploy printers with group policy works perfectly. I think you need R2 if your running server 2003 This works but you cannot set the default until you have windows 2008 servers. This is the situation I have so I am sticking with the scripts for now. Richard
sted Posted April 21, 2010 Posted April 21, 2010 When people use the group policy assigned printers are you using the server 2008 R2 route of deploying them in GP or creating the policy manually with a loopback processing policy to assign a shared printer it to a machine OU? im going to the print management console right clicking the printer in question and selecting deploy with gpo then assigning it to a printers gpo repeat for otehr printers setting them all as per pc rather than per user then adding pushprinterconnections to all user startup sp when users log in the printers appear
Bertv Posted June 1, 2011 Posted June 1, 2011 Here is my solution to deploy printers on a Windows 7 workstation from a Windows 2003 servers login script. This vbs is going a bit further as it will suppress the prompt for any software installation. Modify it as you need. 'This script will disable Driver Signing, UAC, LUA as well as the prompt for any software installation with Windows 7 '=================================================================================== Option Explicit Dim objWMI, objItem, colItems, strComputer, VerOS, VerBig, Ver9x, Version9x, OS, OSystem Set WshNetwork = CreateObject("WScript.Network") strComputer = "." 'Getting OS version Set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") Set colItems = objWMI.ExecQuery("Select * from Win32_OperatingSystem",,48) For Each objItem in colItems VerBig = Left(objItem.Version,3) Next 'Setting up registry If OS = win7 (It won’t affects Win XP) If Trim(VerBig) = “6.1” then Dim WSHShell Set WSHShell = CreateObject(“WScript.Shell”) ‘Adding point and print to registry (This is part of the policy in win 2008) ‘These reg keys don’t exist and will be created. WSHShell.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT\Printers\PointAndPrint\restricted", "0", "REG_DWORD" WSHShell.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT\Printers\PointAndPrint\TrustedServers", "0", "REG_DWORD" WSHShell.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT\Printers\PointAndPrint\ServerList", "" WSHShell.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT\Printers\PointAndPrint\InForest", "1", "REG_DWORD" WSHShell.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT\Printers\NoWarningNoElevationOnInstall", "1", "REG_DWORD" WSHShell.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT\Printers\PointAndPrint\UpdatePromptSettings", "2", "REG_DWORD" 'Disable checking if the driver is certified by Microsoft WSHShell.RegWrite "HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows NT\Driver signing\BehaviorOnFailedVerify", "0", "REG_DWORD" 'Disable UAC and LUA (Won't prompt to run for any software) WSHShell.RegWrite "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System\EnableLUA", "0", "REG_DWORD" WSHShell.RegWrite "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System\ConsentPromptBehaviorAdmin", "0", "REG_DWORD" End if 'Installing printers WshNetwork.AddwindowsPrinterConnection "\\servername\printer name" WshNetwork.SetDefaultPrinter "\\servername\printer name" WshNetwork.AddwindowsPrinterConnection "\\servername\other printer name"
Bertv Posted June 1, 2011 Posted June 1, 2011 If you copy this script, delete the extra space in 'Wi ndows" or 'Cur rentVersion". This is is a result of a cut and paste as the lines were truncated in my editor
Chunks_ Posted June 1, 2011 Posted June 1, 2011 If you dont wish to run a different script on each of your OU's you can add the printer deployment to your logon script, it picks up what OU the computers is in and uses a case statatement to deploy the printer. Maybe of some help to people so here is a link - Printer deployment script - Works with Windows 7 server 2008 / windows xp 2003. Not sure about the windows 7 - 2003 combo though.
ricki Posted June 6, 2011 Posted June 6, 2011 HI I have had to give up on scripts to apply printers to windows 7 machines and have had to go over to group policy. Richard
stuartp44 Posted June 7, 2011 Posted June 7, 2011 I used to use this one Implementing powerful and flexible login scripts! - VBScript FAQ - Tek-Tips however with the introduction of CSP i dont really need it anymore.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now