Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Server > Active Directory > Logon script

Reply
 
 
Mick
Guest
Posts: n/a

 
      11-16-2009
I have a number of computer objects in an OU. I want to create a logon script
that sets the default printer for these PCs no matter who logs on to them.
How do I do this and can you give an example please? Thanks for any replies.
 
Reply With Quote
 
 
 
 
Richard Mueller [MVP]
Guest
Posts: n/a

 
      11-16-2009

"Mick" <> wrote in message
newsC05BC00-F632-416F-8039-...
>I have a number of computer objects in an OU. I want to create a logon
>script
> that sets the default printer for these PCs no matter who logs on to them.
> How do I do this and can you give an example please? Thanks for any
> replies.


You can configure a logon script in a GPO assigned to the OU, but this would
apply to all users in the OU, no matter which computer they use. Also, users
in another OU that logon will get the script. You cannot do this is in a
Startup script. You almost need to use a GPO applied to the domain, and
check for the OU of the computer in the logon script. For example the
VBScript logon script could be similar to (not tested):
=========
Option Explicit
Dim objSysInfo, strComputerDN, objComputer, strParent
Dim objNetwork

Set objNetwork = CreateObject("Wscript.Network")

' Retrieve DN of local computer.
Set objSysInfo = CreateObject("ADSystemInfo")
strComputerDN = objSysInfo.ComputerDN

' Retrieve ADsPath of parent OU of computer)
Set objComputer = GetObject("LDAP://" & strComputerDN)
strParent = objComputer.Parent

' Check for specific computer parent OU.
If (strParent = "LDAP://ou=West,dc=MyDomain,dc=com") Then
' Assign default printer.
objNetwork.AddWindowsPrinterConnection "\\PrintServer\Laser2"
objNetwork.SetDefaultPrinter "\\PrintServer\Laser2"
End If
======
I hope this helps.

--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--


 
Reply With Quote
 
Meinolf Weber [MVP-DS]
Guest
Posts: n/a

 
      11-16-2009
Hello Mick,

If you have at least one Vista/server 2008 machine you can also use Group
policy preferences instead of scripts. Client OS must be XP/2003 with Client
side extensions installed.

Download and install RSAT on Vista/2008:

RSAT 32bit:
http://www.microsoft.com/downloads/d...displaylang=en

RSAT 64bit:
http://www.microsoft.com/downloads/d...displaylang=en

Then open Control Panel, Programs and features, Turn windows features on
or off, check the tools you like under "Remote Server Administration Tools"



CSE XP 32bit:
http://www.microsoft.com/downloads/d...displaylang=en

CSE XP 64bit:
http://www.microsoft.com/downloads/d...displaylang=en

CSE 2003 32 bit:
http://www.microsoft.com/downloads/d...displaylang=en

CSE 2003 64bit:
http://www.microsoft.com/downloads/d...displaylang=en

CSE Vista 32bit:
http://www.microsoft.com/downloads/d...displaylang=en

CSE Vista 64bit:
http://www.microsoft.com/downloads/d...displaylang=en

Best regards

Meinolf Weber
Disclaimer: This posting is provided "AS IS" with no warranties, and confers
no rights.
** Please do NOT email, only reply to Newsgroups
** HELP us help YOU!!! http://www.blakjak.demon.co.uk/mul_crss.htm


> I have a number of computer objects in an OU. I want to create a logon
> script that sets the default printer for these PCs no matter who logs
> on to them. How do I do this and can you give an example please?
> Thanks for any replies.
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
SBS Logon Script Bill Windows Small Business Server 8 11-16-2009 06:13 PM
GP Logon Script works first time at second user logon Roland Schoen Active Directory 2 11-09-2009 12:19 PM
Detect Vista in Logon Script Dave Windows Vista Administration 11 05-25-2008 06:01 PM
User Accounts can't be set to Administrator Steve A. Windows Vista Administration 10 03-09-2008 06:35 AM
Unable to run vbs logon script Wajinga Windows Vista Administration 1 06-13-2006 09:01 PM



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59