Solved

Group Policy Objects

Posted on 2006-10-19
8
368 Views
Last Modified: 2008-01-09
Running windows server 2003. Does a client computer have to be a "managed" pc with the guid entered for any of the settings in the group policy under "computer configuration " to take effect?

I am trying to set up a log on script to add the shared printer to all the pc's on the network but none of the settings in the "computer configuration" section of the GPO will take.

The ones I set in the "user configuration" section of the GPO work great.

Also If I get the log on script to work in the "computer configuration" section will this load the printer onto that pc for all users that log on because currently it always displays "connecting to" the shared printer at log on.

Thanks
0
Comment
Question by:amdvar
  • 2
  • 2
  • 2
  • +2
8 Comments
 
LVL 18

Accepted Solution

by:
Don S. earned 125 total points
Comment Utility
In order to get a Group Policy, a computer must have been joined to the domain and must be in a container or OU that the GPO is applied to.  As for shared printers, are you referring to a printer that is setup on a particular computer and is set as shared?  That would then be treated as a newtork printer.  Network printers are User profile dependant.  If I have a lot of them, I usually create a VB script to run at login time to dynamically assign network printers.
0
 

Author Comment

by:amdvar
Comment Utility
Yes the printer is shared on the server \\server\lexmark

We have roaming users and I was hoping to get away from the box that came up every time someone logged on saying it was connecting to "lexmark on server"

0
 
LVL 17

Expert Comment

by:jburgaard
Comment Utility
Where I work, printers are asigned to the user logging on by means of a kix-script witch is called from a common logon.bat.
In the printer.kix there is a 'case' statement for every room telling whitch printer(s) to connect to. The the printer.kix will sort this out by means of the OU in whitch the  logged on to computer is placed.

If you are interested I can post an ex. tomorrow
0
 

Author Comment

by:amdvar
Comment Utility
Sure that would be great

Thanks
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 10

Assisted Solution

by:Chris_Gralike
Chris_Gralike earned 50 total points
Comment Utility
the same can be done using windows WMI scripting. If you would like an example just call out. the WMI doesnt show as a dos box like kix does, dont miss understand me, kix was great when the WMI objects wherent sufficient to do all the tasks one would like. But this has changed with windows 2K / 2K3 where vbs / wmi are the slowly becomming the standard for login scripts.

Next to that, depending on your AD design, wmi is able to enumerate allready mapped drives, enumerate group objects in wich users / computers are placed and or enumerate in wich OU the domain object resides. A disadvantage is that WMI / VBS is harder to understand, and kix is verry straight forward....

Regards,
0
 
LVL 4

Expert Comment

by:PaulRKrueger
Comment Utility
I would like to see the examples of both.
0
 
LVL 17

Assisted Solution

by:jburgaard
jburgaard earned 75 total points
Comment Utility
In this simple ex. in room 1 you have a printer and a plotter and want to use the minoltaprinter on prtsrv1 as default.
In room2 the script also deletes an unwanted connection.

If working with a nested OU-structure, this script will find the deepest level of OU and try to find a match in the case-select structure

;printer.kix
CALL @LSERVER + "\netlogon\kix\translatename.kix"

; Find the OU where the Computer is placed
$name1 = "@Domain\@wksta$"
$TranslateComputerName = TranslateName(3, "", 3, $name1, 1)
$rc = split($TranslateComputerName[0],",")
$OUnavn = substr($rc[1],4)

? $OUnavn

 SELECT
 
      CASE $OUnavn = "room1"
            if AddPrinterConnection("\\prtsrv1\minolta") = 0 ? "Printer ok" ENDIF
            if AddPrinterConnection("\\prtsrv1\plot") = 0 ? "Printer ok" ENDIF
            if SetDefaultPrinter("\\prtsrv1\minolta") = 0 ? "Set default printer" ENDIF
            
      CASE $OUnavn = "room2"
            if AddPrinterConnection("\\prtsrv2\room2") = 0 ? "Printer ok" ENDIF
            if SetDefaultPrinter("\\prtsrv2\room2") = 0 ? "Set default printer" ENDIF
            if ExistKey("HKEY_CURRENT_USER\Printers\Connections\,,prtsrv1,plot") = 0
                  $x = DELPRINTERCONNECTION ("\\prtsrv1\plot")  
            ENDIF
      
ENDSELECT

RETURN
------
;TranslateName.KIX
FUNCTION TranslateName ($inittype, $bindname, $lookupnametype, $lookupname, $returnnametype)
  DIM $inittype, $bindname, $lookupnametype, $lookupname, $returnnametype
  DIM $nametranslate, $returnname, $error, $errortext

  $error = 0
  $errortext = ""
  $returnname = ""
  $nametranslate = CreateObject ("NameTranslate")
  $error = @error
  $errortext = @serror
  IF ($error = 0)
    $nametranslate.init ($inittype, $bindname)
    $error = @error
    $errortext = @serror
    IF ($error = 0)
      $nametranslate.set ($lookupnametype, $lookupname)
      $error = @error
      $errortext = @serror
      IF ($error = 0)
        $returnname = $nametranslate.get($returnnametype)
        $error = @error
        $errortext = @serror
      ENDIF
    ENDIF
  ENDIF
  $translatename = $returnname, $error, $errortext
ENDFUNCTION ; - TranslateName
-----
;InContainer.kix
FUNCTION InContainer ($container, $nametype)
  DIM $container, $currentcontainer, $nametype, $name1, $name2
  SELECT
  CASE $nametype = "Computer"
    $name1 = "@Domain\@wksta$"
  CASE $nametype = "User"
    $name1 = "@LDomain\@UserID"
  CASE 1
    $name1 = ""
  ENDSELECT
  ;
  IF ($name1 <> "")
    $name2 = translatename(3, "", 3, $name1, 1)
    IF $name2[1] = 0
      $currentcontainer = Substr($name2[0], InStr($name2[0], ",")+1)
      SELECT
      CASE $currentcontainer = $container
        $incontainer = 1, $name2[1], $name2[2]
      CASE InStr($name2[0], $container)
        $incontainer = 2, $name2[1], $name2[2]
      CASE 1
        $incontainer = 0, $name2[1], $name2[2]
      ENDSELECT
    ELSE
      $incontainer = -2, $name2[1], $name2[2]
    ENDIF
  ELSE
    $incontainer = -1, 0, ""
  ENDIF
ENDFUNCTION ; - InContainer -
---
0
 
LVL 10

Expert Comment

by:Chris_Gralike
Comment Utility
You will need to combine these two...

(Printer migration script i wrote)

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'#########################################################'
'#                                                        #'
'#  Printer Migratie Script, doel : Uitfacering AMISNT19  #'
'#  door : Chris Gralike                                  #'
'#  wanneer: 19-7-2005                                    #'
'#  voor: Amis Services BV                                #'
 '#                                                      #'
  '######################################################'
  ''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Set AmisNetwork = CreateObject("WScript.Network")

'#Remark# Disconnecting All Network Printers '
Set AmisPrint = AmisNetwork.EnumPrinterConnections
For LOOP_COUNTER = 0 To Amisprint.Count -1 Step 2
      If Left(AmisPrint.Item(LOOP_COUNTER +1) ,2) = "\\" Then
            AmisNetwork.RemovePrinterConnection AmisPrint.Item(LOOP_COUNTER +1),True ,True
      End If
Next
WScript.sleep 200

AmisNetwork.AddWindowsPrinterConnection "\\AMIS\0MG-CLJ-A4N"
AmisNetwork.AddWindowsPrinterConnection "\\AMIS\0MG-MFP-A4"
AmisNetwork.AddWindowsPrinterConnection "\\AMIS\001-LJ-A4"
AmisNetwork.AddWindowsPrinterConnection "\\AMIS\001-LJ-A4-MS"
AmisNetwork.AddWindowsPrinterConnection "\\AMIS\1MG-DJ-A1"
AmisNetwork.AddWindowsPrinterConnection "\\AMIS\1MG-LJ-A4"
AmisNetwork.AddWindowsPrinterConnection "\\AMIS\2MG-LJ-A4"
AmisNetwork.AddWindowsPrinterConnection "\\AMIS\004-LJ-A4"
AmisNetwork.AddWindowsPrinterConnection "\\AMIS\006-LJ-A4N"
AmisNetwork.addWindowsPrinterConnection "\\\DIS-Laserprinter"
                                                                                                                                                                                                                     
AmisNetwork.SetDefaultPrinter "\\AMIS\0MG-MFP-A4"


 Dim AMISShell
 Set AMISShell = WScript.CreateObject("WScript.Shell")
 Driveletter = "Y:"

AmisNetwork.MapNetworkDrive "Y:", "\\\data\Applications\Service & beheer\Scripts\Printer_Change"
AMISShell.run("Y:\printers.reg")

WScript.sleep 6000

AmisNetwork.RemoveNetworkDrive Driveletter, True, True

Set AmisNetwork = Nothing
Set AmisPrint = Nothing
Set AMISShell = Nothing

----------An Example of Domain Object and selecting based on that,,, ----------

'========================================================'
'       Document: AmisLogin.Vbs                      '
'      Author  : Chris Gralike                         '
'      Edited  : 29-6-2005                         '
'      Language: WScript _ VBS                         '
'========================================================'

'#Remark# Defining Classes '

Dim AmisNetwork, AmisShell, objDomain, Domainstr, Userstr, locDrives, UserObj, Path

'#Remark# Setting Functions '
Set WHSNetwork = CreateObject("WScript.Network")
Set WHSShell   = CreateObject("WScript.Shell")

'#Remark# Find a Domain Name '
Set objDomain = GetObject("LDAP://rootDse")
Domainstr     = objDomain.Get("dnsHostName")

'#Remark# Find the Computername '
strComputer = WHSNetwork.ComputerName

'#Remark# Synchronise Computer time With NTP Server '
WHSShell.Run "Net Time \\AmisNT02 /Set /Yes"

'#Remark# Updating Policies just to be sure '
WHSShell.Run "GPUPDATE"

'#Remark# Disconnecting All Mapped Shares '

Set localDrives = WHSNetwork.EnumNetworkDrives
For i = 0 to localDrives.Count -1 step 2
      WHSNetwork.RemoveNetworkDrive localDrives.Item(i), True, True
Next
Wscript.sleep 200


'#Remark# Find username, and bind it to userobject to find groups '

Userstr = WHSNetwork.UserName
Set UserObj = GetObject("WinNT://" & Domainstr & "/" & Userstr)


For Each GroupObj in UserObj.Groups
      ' Developers Comment    WSH.Echo GroupObj.Name'
      Select Case GroupObj.Name
'#Help# All text after The Case Function are Actuall Domain Groups '
      Case "Domain Users"
            'All Group dependant Network connections'
            WHSNetwork.MapNetworkDrive "O:", "\\Amis\Amis_Ora", True            
      End Select
Next

WSH.echo "Logon Succesfull"


Set WHSNetwork = Nothing
Set WHSShell = Nothing
Set locDrives = Nothing
Set objDomain = Nothing
Set UserObj = Nothing
WScript.Quit

Hope this helps ;-)

Regards,

ps there is allot of ducumentation on the various microsoft websites containing topics on this subject...
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Some time ago I was asked to set up a web portal PC to put at our entrance. When customers arrive, they could see a webpage 'promoting' our company. So I tried to set up a windows 7 PC as a kiosk PC.......... I will spare you all the annoyances I…
ADCs have gained traction within the last decade, largely due to increased demand for legacy load balancing appliances to handle more advanced application delivery requirements and improve application performance.
After creating this article (http://www.experts-exchange.com/articles/23699/Setup-Mikrotik-routers-with-OSPF.html), I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now