Jump to content

Recommended Posts

Posted

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 .. :tinfoil3:

Craig

Posted

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

 

'  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

  • 11 months later...
Posted

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

 

:cool::bored::troll::troll::troll::tinfoil3::sick::eek::p:)

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 account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...