Windows Thread, Adding a printer to the students mandatory profile in Technical; Hi, I'm in the testing phase of setting up super mandatory profiles for our students. I have followed the instructions ...
1. ## Adding a printer to the students mandatory profile

Hi, I'm in the testing phase of setting up super mandatory profiles for our students.

I have followed the instructions in the wiki and got them working well for a couple of test student accounts.. I'm testing them on a fresh client virtual machine running xp.

I can log in as what the wiki calls the mpm and change files on the desktop.

The problem is the printers. I add a printer on the mpm user and replace the mandatory profile with it's profile. But the student doesn't get any printers.

I tried an adapted version of the vbs login script that we currently use for the students to add printers. However it gives me an "Loading your settings failed. (access denied)" from the windows script host. If I try to add the printer from \\printers by the double click to add method.. it also says access denied. which is strange.. because that works fine for normal students in the same windows group

hmmmmm grrrrrr ..
Craig

2. I use a assign printers by logon script (VBS) - I'll dig that out and paste it here, give me a sec...

3. Hiya Craig,

Here's a copy of my script - looks like I heavily commented it at the time of writing.

When the script starts to run it files an event in the Application log (event source of WSH if memory serves), then another entry explaining what it determines the printer to be and then one entry when the script finishes.

The script determines what printers should be mapped dependant on the computer name so you'll need to customise that a bit. Any problems shout me!

Never seen "Loading your settings failed. (access denied)" other than a profile error - is it definitely coming up as a result of the logon script? I trust you're only specifying logon scripts at one point in the GPO tree?
Jonathan

Code:
'  VBScript to map printers - Windows User logon script
'  ----------------------------------------
' Put in place on Barton Court's network Summer 2008
' Jonathan Haddock, Network Manager
' Last modified:
' 2009-05-28 (JHA) to add logging to the script.
' Previously modified 2009-05-21 to take into consideration the art room and actually fix the code I left broken.

' this script:
' 0) Removes all old networked printers
' 1) Checks to see if the computer is in the library (computers called LIBx) or IB Center (IBx)
' 2) If not in either of the above, checks to see if the computer is in a "room" (i.e. has computer name rmxxyy)
' 3) Dependant on which room the printer is in, we set the vales for the black and colour variables accordingly
' 4) If the computer name doesn't show any of these rooms, do nothing
'  ----------------------------------------

' If a variable is not defined, complain:
Option Explicit
' If there's an error, continue:
On Error Resume Next

' Define the variables (if you don't define the variables here you WILL get an error:
Dim WSHNetwork, WSHPrinters, LOOP_COUNTER, net, workstation, location, multiPrinter, black, colour, Message, Logit, Logit2, IntoLog

'Add code for event logging
Const ntSUCCESS       = 0
Const ntERROR         = 1
Const ntWARNING       = 2
Const ntINFORMATION   = 4
Const ntAUDIT_SUCCESS = 8
Const ntAUDIT_FAILURE =16

Set IntoLog = WScript.CreateObject("WScript.Shell")
'End code for event logging

'Place an entry in the log to show the script is running:
Message = "START - Printer mapping script now running"
Logit = IntoLog.LogEvent(ntINFORMATION, Message)

'Remove ALL old printers
' This code is from http://www.tek-tips.com/faqs.cfm?fid=5798
'Enumerate all printers first, after that you can select the printers you want by performing some string checks
Set WSHNetwork = CreateObject("WScript.Network")
Set WSHPrinters = WSHNetwork.EnumPrinterConnections
For LOOP_COUNTER = 0 To WSHPrinters.Count - 1 Step 2
'To remove only networked printers use this If Statement
If Left(WSHPrinters.Item(LOOP_COUNTER +1),2) = "\\" Then
WSHNetwork.RemovePrinterConnection WSHPrinters.Item(LOOP_COUNTER +1),True,True
End If
Next

' First, we see if the computer is in the library (LI) or the IB center (IB)
Set net = CreateObject("WScript.Network")
workstation = net.computername
location=LCase(left(workstation,2))
' DEBUG : Uncomment the line below to be shown the first 2 figures of the computer name
' WScript.echo location

' Set the variables for computers in the LIBRARY (LI) or the IB Center (IB)
select case location
case "li"
black="\\printers\library"
case "ib"
black="\\printers\ibblk"
case "AR"
'If the computer is in ART (ARTxx)
colour="\\printers\ARTCOLOR"
End Select

' If it's not in either of those, we'll see if the computer is in any other computer room that starts with rm
' if location <> "LI" OR location <> "IB" then WScript.echo "Not in the library or IB Center"
if location <> "li" OR location <> "ib" then location=LCase(left(workstation,4))
' Get the computer name from the workstation
' DEBUG : Uncomment the line below to be shown the first 4 figures of the computer name
' WScript.echo location

select case location
case "rm06"
colour="\\printers\rm06clr"
case "RM06"
colour="\\printers\rm06clr"

End Select

' Now we map some printers
Set multiPrinter = CreateObject("WScript.Network")
' Map the black printer first, if a printer has been specified
if black <> "" then
'	WScript.echo black
multiPrinter.AddWindowsPrinterConnection black
multiPrinter.SetDefaultPrinter black
End If
' Map the Colour printer second if one has been specified
if colour <> "" then
'	WScript.echo colour
multiPrinter.AddWindowsPrinterConnection colour
if black = "" then multiPrinter.SetDefaultPrinter colour
End If

'Place an entry in the log to show the script has finished running:
Message = "END - Printer mapping script now Finished.  Black printer was: "&black&" and the colour printer was: "&colour&" (if no colour printer name shows it may be that none was specified).  Check the printers are installed"
Logit2 = IntoLog.LogEvent(ntINFORMATION, Message)

' Cleanly end and exit the script
WScript.Quit

4. OK and we're back looking at this problem again...

We still can't run our normal Wsh script for adding the printers..

Furthermore, if we browse to the printers server as in the attached screenshot we don't have permission to add printers.

The MPM account used to create the mandatory profile can add printers this way. Student and staff accounts that use a normal roaming profile can add printers this way just fine!

We are using 2003 R2 as DCs and printer server, XP SP3 for the clients, we get the same thing happening on both a VM and on a real computer lab machine.

Any ideas?

mand prof print error.png

SHARE:

#### Thread Information

##### Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•