Question Locked

Startup script on computers doesn not work via group policy

0 helpful
4 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

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 = "" ' e.g. AMER\rallen
strPassword = ""
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 replies

by Member 25348569

The script is trying to run on the computer when it starts up. If you want the users to pick up the drive when they log on, you'll need to put it in User Configuration | Windows Settings | Scripts | Logon in a GPO that the users pick up.

by cfrond

As the previous post mentioned your script is set on the Machine instead of the User. The path for the script should look like:

C:\WINDOWS\sysvol\sysvol\d214.org\Policies\{7BAA60E2-3C6D-4D88-A18B-2E15A6A457F0}\User\Scripts\Login

See if this doesn't help you some,

Assign Logon Script via Group Policy
http://www.computerperformance.co.uk/Logon/logon_script_assign.htm

by ikram.hussain

Yes, after setting it to user it works.

Thanks a lot to all of you.

This discussion is closed to new replies.