Link to home
Start Free TrialLog in
Avatar of bobgraf
bobgrafFlag for United States of America

asked on

Problem with AD Logon Script referring to VBS file

We run Windows Server 2008 R2. I created a logon script that referred to a VBS file that would map network locations instead of mapped drives since we want to get away from mapped drives. I created two new users that I was testing the script on. Both these users wont map the network locations to their profiles. I then put the script for my logon and it works just fine. What could be wrong with the users profiles or a setting on their computer that would cause the script to not work. I can place the scripts on their desktop and can run it that way but we want it to run when they logon. Note - The script runs fine just wont auto load on logon for the new users that were copied from another.  

Here is the Logon

@echo off
cls

NET USE * /d /y

start C:\design.vbs    (runs off server in reality)

VBS Script

Set WSHShell = CreateObject("WScript.Shell")

Const NETHOOD = &H13&

Set objWSHShell = CreateObject("Wscript.Shell")

Set objShell = CreateObject("Shell.Application")

Set objFolder = objShell.Namespace(NETHOOD)
Set objFolderItem = objFolder.Self
strNetHood = objFolderItem.Path

strPath = objFolderItem.Path & "\*.*"
On Error Resume Next
objFSO.DeleteFile strPath, true

strShortcutName = "Shortcut"
strShortcutPath = "\\server\folder"

Set objShortcut = objWSHShell.CreateShortcut _
(strNetHood & "\" & strShortcutName & ".lnk")
objShortcut.TargetPath = strShortcutPath
objShortcut.Save

WSCript.Quit
Avatar of Will Szymkowski
Will Szymkowski
Flag of Canada image

When you are referencing a script in the Logon Script area under the profile Tab in the AD Account, these scripts need to be located in the Netlogon Share. This Share gets replicated among all of the DC's in the domain.

If you have the script anywhere else other than in the Netlogon Share it will not work.
User generated image
if you want to run logon scripts from a network location and not the Netlogon Share then you would use GPO's and startup scripts referencing the complete path where the script is located.

Personally, not sure why you wouldn't use Group Policy Preferences for mapping network drives. It is much easier and much more flexible.

Take a look below for more details on this.
http://blogs.technet.com/b/askds/archive/2009/01/07/using-group-policy-preferences-to-map-drives-based-on-group-membership.aspx

Will.
Avatar of bobgraf

ASKER

I've requested that this question be deleted for the following reason:

I figured it out myself
Seriously?

This ticket has been open all after noon with no comments, and as soon as i post something you state that you resolved this issue on your own with no explanation on how you corrected this issue.

common,

Will.
ASKER CERTIFIED SOLUTION
Avatar of bobgraf
bobgraf
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Forgot to refesh the page? The question has been open for 4+ hours. Anyways glad you got your answer.

Will.