Results 1 to 4 of 4

Thread: Group Policy Object for startup scripts on computers doesn't work

  1. #1
    Ikram Guest

    Group Policy Object for startup scripts on computers doesn't work

    I have a batch file and vbscript for mapping a network drive, which I am
    using in the GPO and it doesn't work.

    In Active Directory Users and Computers, I have an OU, I right click on the
    OU and go to properties and select the Group Policy tab, and create a new
    policy by a name test.

    Then click Edit on that test policy and go to the Computer Configuration |
    Windows Settings | Scripts | Startup and then click the Add and in the Script
    Name click the Browse which opens the startup folder, I copy my vbscript or
    batch file as shown below:

    Batch File:
    NET USE Z: \\F-AD\DATA /PERSISTENT:YES

    VbScript:
    ' ------ SCRIPT CONFIGURATION ------
    strDrive = "Z:"
    strPath = "\\F-AD\DATA"
    strUser = "<User>" ' e.g. AMER\rallen
    strPassword = "<Password>"
    boolPersistent = True ' True = Persistent ; False = Not Persistent
    ' ------ END CONFIGURATION ---------
    set objNetwork = WScript.CreateObject("WScript.Network")
    objNetwork.MapNetworkDrive strDrive, strPath, boolPersistent
    WScript.Echo "Successfully mapped drive"

    Then close all the windows, and then login from one of the Windows XP
    machine from that OU, and the drive letter doesn't get mapped.

    Any help is appreciated, as I have about 30computers in that ou, that needs
    to be mapped to that drive letter, any one who logs into it.

    But after logging in If I run the batch file or the vbscript from that
    folder as shown below, it runs fine:
    C:\WINDOWS\sysvol\sysvol\d214.org\Policies\{7BAA60E2-3C6D-4D88-A18B-2E15A6A457F0}\Machine\Scripts\Startup

  2. #2
    Paul Bergson [MVP-DS] Guest

    Re: Group Policy Object for startup scripts on computers doesn't work

    This may have to do with the fact when you logon, the network may not be
    ready yet. You can disable this quick logon and have the system wait,
    similar to how Windows 2000 used to handle authentication. To fully
    understand check out the link below:

    http://support.microsoft.com/kb/305293

    I would suggest disable the fast logon and see if this resolves your
    problems.

    --
    Paul Bergson
    MVP - Directory Services
    MCTS, MCT, MCSE, MCSA, Security+, BS CSci
    2008, 2003, 2000 (Early Achiever), NT4
    Microsoft's Thrive IT Pro of the Month - June 2009

    http://www.pbbergs.com

    Please no e-mails, any questions should be posted in the NewsGroup This
    posting is provided "AS IS" with no warranties, and confers no rights.

    "Ikram" <Ikram@discussions.microsoft.com> wrote in message
    news:B7C13921-1CCB-4B9D-8EE2-E5BF6F33B0BD@microsoft.com...
    >I have a batch file and vbscript for mapping a network drive, which I am
    > using in the GPO and it doesn't work.
    >
    > In Active Directory Users and Computers, I have an OU, I right click on
    > the
    > OU and go to properties and select the Group Policy tab, and create a new
    > policy by a name test.
    >
    > Then click Edit on that test policy and go to the Computer Configuration |
    > Windows Settings | Scripts | Startup and then click the Add and in the
    > Script
    > Name click the Browse which opens the startup folder, I copy my vbscript
    > or
    > batch file as shown below:
    >
    > Batch File:
    > NET USE Z: \\F-AD\DATA /PERSISTENT:YES
    >
    > VbScript:
    > ' ------ SCRIPT CONFIGURATION ------
    > strDrive = "Z:"
    > strPath = "\\F-AD\DATA"
    > strUser = "<User>" ' e.g. AMER\rallen
    > strPassword = "<Password>"
    > boolPersistent = True ' True = Persistent ; False = Not Persistent
    > ' ------ END CONFIGURATION ---------
    > set objNetwork = WScript.CreateObject("WScript.Network")
    > objNetwork.MapNetworkDrive strDrive, strPath, boolPersistent
    > WScript.Echo "Successfully mapped drive"
    >
    > Then close all the windows, and then login from one of the Windows XP
    > machine from that OU, and the drive letter doesn't get mapped.
    >
    > Any help is appreciated, as I have about 30computers in that ou, that
    > needs
    > to be mapped to that drive letter, any one who logs into it.
    >
    > But after logging in If I run the batch file or the vbscript from that
    > folder as shown below, it runs fine:
    > C:\WINDOWS\sysvol\sysvol\d214.org\Policies\{7BAA60E2-3C6D-4D88-A18B-2E15A6A457F0}\Machine\Scripts\Startup




  3. #3
    Marcin Guest

    Re: Group Policy Object for startup scripts on computers doesn't work

    This looks like a logon script that should be assigned via GPO linked to
    user acconts - rather than a startup script that is part of the computer
    configuration...

    hth
    Marcin

    "Ikram" <Ikram@discussions.microsoft.com> wrote in message
    news:B7C13921-1CCB-4B9D-8EE2-E5BF6F33B0BD@microsoft.com...
    >I have a batch file and vbscript for mapping a network drive, which I am
    > using in the GPO and it doesn't work.
    >
    > In Active Directory Users and Computers, I have an OU, I right click on
    > the
    > OU and go to properties and select the Group Policy tab, and create a new
    > policy by a name test.
    >
    > Then click Edit on that test policy and go to the Computer Configuration |
    > Windows Settings | Scripts | Startup and then click the Add and in the
    > Script
    > Name click the Browse which opens the startup folder, I copy my vbscript
    > or
    > batch file as shown below:
    >
    > Batch File:
    > NET USE Z: \\F-AD\DATA /PERSISTENT:YES
    >
    > VbScript:
    > ' ------ SCRIPT CONFIGURATION ------
    > strDrive = "Z:"
    > strPath = "\\F-AD\DATA"
    > strUser = "<User>" ' e.g. AMER\rallen
    > strPassword = "<Password>"
    > boolPersistent = True ' True = Persistent ; False = Not Persistent
    > ' ------ END CONFIGURATION ---------
    > set objNetwork = WScript.CreateObject("WScript.Network")
    > objNetwork.MapNetworkDrive strDrive, strPath, boolPersistent
    > WScript.Echo "Successfully mapped drive"
    >
    > Then close all the windows, and then login from one of the Windows XP
    > machine from that OU, and the drive letter doesn't get mapped.
    >
    > Any help is appreciated, as I have about 30computers in that ou, that
    > needs
    > to be mapped to that drive letter, any one who logs into it.
    >
    > But after logging in If I run the batch file or the vbscript from that
    > folder as shown below, it runs fine:
    > C:\WINDOWS\sysvol\sysvol\d214.org\Policies\{7BAA60E2-3C6D-4D88-A18B-2E15A6A457F0}\Machine\Scripts\Startup




  4. #4
    Richard Mueller [MVP] Guest

    Re: Group Policy Object for startup scripts on computers doesn't work

    Startup scripts run when the computer starts up and authenticates to the
    domain, before there are any users. Any mappings in a startup script will
    not be available to users. You should use a logon script instead.

    If you need to have any users get the mapping only when they logon to a
    computer that resides in the specified OU, that can be done in a VBScript
    logon script, but then it must apply to all users in the domain (a group
    policy applied to the domain). If I understand what you are trying to do, I
    would suggest:
    =========
    Option Explicit
    Dim objSysInfo, strComputerDN, objComputer, strParent
    Dim objNetwork, strDrive, strPath

    blnPersistent = True
    Set objNetwork = CreateObject("Wscript.Network")

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

    ' Bind to the computer object and
    ' retrieve the ADsPath of the parent OU/Container.
    Set objComputer = GetObject("LDAP://" & strComputerDN)
    strParent = objComputer.Parent

    ' Check if the local computer is in specified OU.
    If (strParent = "LDAP://ou=Sales,ou=West,dc=MyDomain,dc=com") Then
    ' Map the drive.
    objNetwork.MapNetworkDrive strDrive, strPath, blnPersistent
    End If
    ========
    If you have several OU's to be treated in a similar manner, you can use a
    Select Case statement. You must specify the full ADsPath of the OU in the If
    statement. If you want the mapping to apply to an OU and all child OU's,
    maybe you could use:

    If (InStr(LCase(strParent), "ou=west,dc=mydomain,dc=com") > 0) Then

    I made the comparison case insensitive. I would not check for just the
    string "west" or "ou=west", but rather the full DN of the OU.

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

    "Ikram" <Ikram@discussions.microsoft.com> wrote in message
    news:B7C13921-1CCB-4B9D-8EE2-E5BF6F33B0BD@microsoft.com...
    >I have a batch file and vbscript for mapping a network drive, which I am
    > using in the GPO and it doesn't work.
    >
    > In Active Directory Users and Computers, I have an OU, I right click on
    > the
    > OU and go to properties and select the Group Policy tab, and create a new
    > policy by a name test.
    >
    > Then click Edit on that test policy and go to the Computer Configuration |
    > Windows Settings | Scripts | Startup and then click the Add and in the
    > Script
    > Name click the Browse which opens the startup folder, I copy my vbscript
    > or
    > batch file as shown below:
    >
    > Batch File:
    > NET USE Z: \\F-AD\DATA /PERSISTENT:YES
    >
    > VbScript:
    > ' ------ SCRIPT CONFIGURATION ------
    > strDrive = "Z:"
    > strPath = "\\F-AD\DATA"
    > strUser = "<User>" ' e.g. AMER\rallen
    > strPassword = "<Password>"
    > boolPersistent = True ' True = Persistent ; False = Not Persistent
    > ' ------ END CONFIGURATION ---------
    > set objNetwork = WScript.CreateObject("WScript.Network")
    > objNetwork.MapNetworkDrive strDrive, strPath, boolPersistent
    > WScript.Echo "Successfully mapped drive"
    >
    > Then close all the windows, and then login from one of the Windows XP
    > machine from that OU, and the drive letter doesn't get mapped.
    >
    > Any help is appreciated, as I have about 30computers in that ou, that
    > needs
    > to be mapped to that drive letter, any one who logs into it.
    >
    > But after logging in If I run the batch file or the vbscript from that
    > folder as shown below, it runs fine:
    > C:\WINDOWS\sysvol\sysvol\d214.org\Policies\{7BAA60E2-3C6D-4D88-A18B-2E15A6A457F0}\Machine\Scripts\Startup




Similar Threads

  1. Folder Redirection policy object don't exist in group policy
    By Mohammad_dn in forum Operating Systems
    Replies: 3
    Last Post: 12-01-2011, 11:41 PM
  2. SCE managed computers group policy
    By Halyn in forum Operating Systems
    Replies: 3
    Last Post: 27-06-2009, 06:49 PM
  3. Replies: 2
    Last Post: 29-05-2008, 06:33 AM
  4. Missing Group Policy Object Editor
    By Tiger Tails in forum Vista Help
    Replies: 6
    Last Post: 20-02-2008, 10:33 PM
  5. Group Policy Object Editor on Local Computer
    By Bill MacDonald in forum Vista Help
    Replies: 5
    Last Post: 02-05-2007, 07:58 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,716,441,844.34280 seconds with 17 queries