Hi Guys,
Well just joined as have been reading the hints and problems others have been getting similar to my own but I seem to have come across a problem I cannot rectify... so need some help!
Basically at the school where I work Im using Group Policy to set printers up. Yes, Printer Management Console. Now to be honest Ive read that its a very select bit of software and that some like it and think it works well and some dont. Well for me it works great apart from one thing...
Setting the Default Printer!!!
So, I have created a .vbs script to fix the default printer to the one I specify when users log in. (eg. I dont want all the kids printing to a colour printer all the time when they only have a black and white document!!)
Anyway, I create a new GPO, put the vbs script in the users configuration and link the GPO to the OU where i want it. Now the problem is when the user logs in.
Firstly, pushprinterconnections.exe works fine. It maps the printers but randomly sets one a default, usually for me, one of the colour lasers. Now the setDefaultprinter.vbs script doesnt run.
However, the script itself is fine. If ran manually all works great and the default printer is set. Also, if I add the .vbs script to the Machine configuration in the setDefaultPrinter GPO the script runs and Im prompted on screen as to which printer is now default.... but alas when a user logs in, the default printer isnt set!!!
So, my question is does anyone know what im doing wrong here. Ive tried Kixtart scripts, .vbs scripts and .bat files but they just dont seem to run when in Group policy. Ive been working on this for nearly 2 weeks now and its driving me insane... (not to mention the fact that Ive discovered lots of other issues causing problems along the way!!)
There must be some explaination why this thing is driving me mad!!!
Help!
Firstly, what objects are inside the OU you've applied the GPO to? If you're applying a user policy onto a load of PCs it's not going to work. (Sorry if that is obvious, but I'm not sure how familiar you are with group policies).
From my experience printers tend to be set as login scripts for users, but with some conditional statements in them to give the correct printer (and/or to set the correct default) for a specific location. If you have it set up that way in the script, you could try calling it from your existing login script set up in the properties of the account in AD. If you don't have a login script set up there, you can put your script in the \\yourdc\NETLOGON folder and then make that their login script. We use Kix, so our login script entry looks like:
kix32 pupillogin.kix
with kix32 and pupillogin.kix both living in the NETLOGON folder.
Sorry if any of that is obvious, but for me that would be the starting point.

Firstly, is the script running at all, or is it running but just not doing what it's supposed to for some reason? Easy way to tell, stick a message box statement in your VBS script using the following line;
If you see the message box, then you know it's running the script. If it's not running the script at all, then it could be a GPO issue and the user isn't pulling the GPO's from the server properly.Code:msgbox "Press OK to Continue"
Second, sometimes VBS scripts run a bit quick before the user has properly logged in, and therefore before the printer has been mapped. To get round this, you can stick a delay at the start of your VBS script using a bit of code like;
This script loops until it reads a valid username value, then continues with whatever's underneath. I find this necessary at the beginning of my printer script, or else the users get nothing!Code:Dim WSHNetwork Dim strUserName Set WSHNetwork = WScript.CreateObject("WScript.Network") ' Wait until the user is really logged in... strUserName = "" While strUserName = "" WScript.Sleep 100 ' 1/10 th of a second strUserName = WSHNetwork.UserName Wend
Thirdly, Have you got any software restictions on your network that stop users running .exe files etc. If so, you will need to enable wscript.exe to run VBS scripts. This is quite a common problem for logon scripts, as they're run under the users account, where as machine startup scripts are run under the system account, so you don't get the same problems.
Just a few suggestions that I've run into in the past.
Mike.
Hi Guys,
Thanks alot for the help.
The problem was that I was assigning the GPO which ran at user level to an OU which had machines in it. When i moved it, hey presto it worked.
However, this has only led me to another issue.
Each OU is a different room with IT equipment in. We have 10 rooms all with computers and we have 2 printers in each room. Basically I want the printers in each specific room to be mapped to each specific set of computers. Therefore this GPO mapping would be by machine, not by user.
I seem to understand that you can only map printers by user. Mapping by machine seems to work so far as the script to map them runs but when a user logs in they have no printers. I have therefore thought I could maybe use a script which would check the printers installed on the relevant machine to see which printers are mapped and then assign the mono printer to default.
Im not a coder, nor am I competent with Group Policy or scripts (having only started delving into this wonderful world about 2 weeks ago!!). Does anyone know of any scripts or can anyone tell me what I have to do to work around this problem? Better still does anyone have the same sort of issue they have rectified?
Cheers guys
Rick Lister
Just to let you guys know I've cracked it!!
Using .vbs scripts and 'Group Policy re-looping'
Mapping printers to specific locations based on workstation location!
It might be worth taking a look at printer mapping scripts rather than group policy loopback processing as the latter can slow down the application of group policy quite considerably (although it depends on the specific circumstances).
Take a look at this one on the edugeek wiki for starters (i can't remember whose it is):
http://edugeekwiki.rm-charlton.net/i...ed_on_Location
Our login scripts use KiXtart instead of VBS so they probably wouldn't be much use to you.
UPDATE: It looks like it's Ric's script now I've read the comments...
Just as a hint pushprinterconnections or the R2 printer management tool sets the default printer alphabetically so I bet if you renamed your printer that you want set as default with an a in front of it, it would be set as default and anything after that would not or is it the other way around, either way am sure if you did something like that, it would fix the issue.
As for using a script , that would not help as I think the exe runs after the scripts do so whatever the script does, the pushprinterconnections.exe will undo.
I don't think the printer management tool wanted to set a default printer because they wanted to offer the user a choice of printers and not have one set as default.
As for RIC's wiki I think it got re done and is missing the use of the split function in vbs ( split function would only work if you have a character in your machines names that are common ieOriginally Posted by sahmeepee
Machine1-123
if you wanted the 123 then you could use the split function to find the - characther and return just the 123 instead of trying to do a left or right by a certain amount of characters because if 6 machines out of 20 have 5 characters and the rest of them only use 3 then it will be a problem.
Depends on your machine naming convention though![]()
There are currently 1 users browsing this thread. (0 members and 1 guests)