• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 224
  • Last Modified:

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
0
bobgraf
Asked:
bobgraf
  • 3
  • 2
1 Solution
 
Will SzymkowskiSenior Solution ArchitectCommented:
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.
logonscript.JPG
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.
0
 
bobgrafAuthor Commented:
I've requested that this question be deleted for the following reason:

I figured it out myself
0
 
Will SzymkowskiSenior Solution ArchitectCommented:
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.
0
 
bobgrafAuthor Commented:
Problem was a $ when I was directing it to the server drive example server\C$\folder\design.vbs   removing the $ fixed it. I wasn't running the vbs script off the AD server. The logon script was running from the Netlogon shares but I referred the start file (vbs) to a shared network drive that would allow users permission to run it. As I stated before when I pathed the location I included a C$ which was an admin function which caused the user not to be able to run the file and get an access denied. We don't use GP as unfortunately each user generally has a different set of mapped drives currently. We don't want to use mapped drives due to the randsomware virus and go with network locations that has seemed to prevent the virus from hopping on the server. IF there is GP that will do network locations rather than mapped drives I am open checking it out. I did not refresh the page when I deleted the question so I did not see that you posted and for that I apologize however the answer you gave wouldn't have helped anyway.
0
 
Will SzymkowskiSenior Solution ArchitectCommented:
Forgot to refesh the page? The question has been open for 4+ hours. Anyways glad you got your answer.

Will.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now