Forum Search:
Forum.Brain-Cluster.com: Brain Cluster Technical Forum
Ultimate forum for Technical Discussions

Home » Microsoft » Windows Server » Active Directory » Group Policy Object for startup scripts on computers doesn't work
Group Policy Object for startup scripts on computers doesn't work [message #160611] Wed, 02 September 2009 14:02 Go to next message
Ikram  is currently offline Ikram
Messages: 5
Registered: September 2009
Junior Member
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-4D 88-A18B-2E15A6A457F0}\Machine\Scripts\Startup
Re: Group Policy Object for startup scripts on computers doesn't work [message #160620 is a reply to message #160611] Wed, 02 September 2009 16:40 Go to previous messageGo to next message
pbbergs  is currently offline pbbergs  United States
Messages: 1024
Registered: July 2009
Senior Member
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-4D 88-A18B-2E15A6A457F0}\Machine\Scripts\Startup
Re: Group Policy Object for startup scripts on computers doesn't work [message #160624 is a reply to message #160611] Wed, 02 September 2009 18:18 Go to previous messageGo to next message
Marcin  is currently offline Marcin  United States
Messages: 273
Registered: July 2009
Senior Member
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-4D 88-A18B-2E15A6A457F0}\Machine\Scripts\Startup
Re: Group Policy Object for startup scripts on computers doesn't work [message #160627 is a reply to message #160611] Wed, 02 September 2009 20:00 Go to previous message
rlmueller-nospam  is currently offline rlmueller-nospam  United States
Messages: 292
Registered: July 2009
Senior Member
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-4D 88-A18B-2E15A6A457F0}\Machine\Scripts\Startup
Previous Topic:Re: List all users with 'Password Never Expires'
Next Topic:Slow Login Process
Goto Forum:
  


Current Time: Wed Jan 17 05:48:31 MST 2018

Total time taken to generate the page: 0.02102 seconds
.:: Contact :: Home ::Sitemap::.

Powered by: FUDforum 3.0.0RC2.
Copyright ©2001-2009 FUDforum Bulletin Board Software