bobgraf
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.Shel l")
Const NETHOOD = &H13&
Set objWSHShell = CreateObject("Wscript.Shel l")
Set objShell = CreateObject("Shell.Applic ation")
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
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.Shel
Const NETHOOD = &H13&
Set objWSHShell = CreateObject("Wscript.Shel
Set objShell = CreateObject("Shell.Applic
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
ASKER
I've requested that this question be deleted for the following reason:
I figured it out myself
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.
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Forgot to refesh the page? The question has been open for 4+ hours. Anyways glad you got your answer.
Will.
Will.
If you have the script anywhere else other than in the Netlogon Share it will not work.
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.