Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

logon script (w2k server)

Status
Not open for further replies.

studio39

Technical User
Jan 7, 2004
4
US
I have a logon script in the netlogon shared folder on the domain controller and have assigned it to a specific user in active directory, however it does not run when the user logs in. Any help would be greatly appreciated.

(the logon script works fine when run locally)
 
I have tried several different names. Right now i have it named netlogon.bat
 
I take it you put it under the profile tab for the user.
Are you sure the user is logging onto the domain and not logging onto the workstation locally and mapping drive?
 
1. Check permissions dude!

2. Make sure that the scipt name is specified in the users profile settings. This is done by right clicking the user in AD and navigating to the Profile Tab. Within this tab there is a login script field where you specify the script filename.

3. The script also has to be in the correct directory on the domain controller (\\servername\netlogon).

4. Check login script syntax too. I'm not sure what is in your login script(s) but all I have in ours is syntax for network drives: net use X: \\Servername\sharename

This was a pain in my kazoo too for awhile when I first got Win2k Server & AD up and running. There isn't alot of documentation on logon sripts for some reason... Good luck bro!

 
thedman00 brought up a good point: make sure you're logging that user into the domain otherwise it will never work.

I've found that sometimes the scripts run so fast you don't actually get to see it run. verify that the script is not running somehow and that the drive letter, if applicable, is not already in use.

Again, good luck buddy!
 
sorry the verbage of my last post, i was doing two things at once. I meant to say sometimes the scripts run so fast that you don't get to watch them execute so make sure they aren't working somehow. Also, make sure the drive letter, if applicable, is not already in use.

later!
 
Thanks for the input, but i am still having no luck. I talked to our old administrator and apparently she gave up trying to solve this.

The user is logging on to the domain, not the local machine.I have checked the permissions and they are fine. I also doublechecked the path specified in the AD profile tab. As i mentioned earlier, the file runs properly when i launch it manually so there shouldn't be any issues
with the syntax.

I have searched the web and not come across anyone with similar problems. Everything seems to be setup properly, but i am not getting any error messages so i am not sure where to go from here.

Thanks
 
you could try putting a pause at the end of the login script so that you can see what it says when it runs on the workstation.
 
I have a similar problem too!
I've tried storing my logon script in two different places.

1.\\yourdomainname.com\netlogon
2.\\yourdomainname.com\SysVol\yourdomainname.com\Policies\{long random string...}\User\Logon

They didn't work. Here is my script...

**********************************************************

OPTION EXPLICIT

ON ERROR RESUME NEXT

Dim oNet, oShell, oFileSys, oShortCut, oDrives, oPrinters
Dim DesktopPath, SomePath
Dim defPrinter

Set oNet = CreateObject("Wscript.Network")
Set oShell = CreateObject("WScript.Shell")
Set oFileSys = CreateObject("Scripting.FileSystemObject")

defPrinter = "SOME_PRINTER"

Set oDrives = oNet.EnumNetworkDrives
For index = 0 to oDrives.Count -1 Step 2
If oDrives.Item(index) <> &quot;T:&quot; Then
oNet.RemoveNetworkDrive oDrives.Item(index)
End If
Next
oNet.MapNetworkDrive &quot;T:&quot;, &quot;\\SERVER\SHARE&quot;, False

Set oPrinters = oNet.EnumPrinterConnections
For index = 0 to oPrinters.Count -1 Step 2
If oPrinters.Item(index+1) <> &quot;Adobe PDF&quot; And _
&quot;DYMO LabelWriter 310&quot; And _
&quot;DYMO LabelWriter 315&quot; And _
defPrinter Then
oNet.RemovePrinterConnection oPrinters.Item(index+1)
End If
Next

oNet.AddWindowsPrinterConnection defPrinter
oNet.SetDefaultPrinter defPrinter

If oFileSys.FileExists(SOME_FILE) Then
CreateProgFolder SOME_PATH
CreateProgShortcut SOME_PATH & &quot;\SOME_SHORTCUT.lnk&quot;, _
&quot;SOME_PATH&quot;, &quot;SOME_PATH&quot;
CopyShortcut &quot;SOME_PATH&quot;, &quot;SOME_PATH&quot; + &quot;\*.lnk&quot;, &quot;\SOME_SHORTCUT*.lnk&quot;
End If

Set oShortCut = Nothing
Set oNet = Nothing
Set oShell = Nothing
Set oFileSys = Nothing
Set oDrives = Nothing
Set oPrinters = Nothing

Function CreateProgFolder(Path)
If Not (oFileSys.FolderExists(Path)) Then
oFilesys.CreateFolder(Path)
End If
End Function

Function CreateProgShortcut(ShortcutPath, TargetPath, WDirectory)
If Not (oFileSys.FileExists(oFileSys.FileExists(ShortcutPath))) Then
Set oShortCut = oShell.CreateShortcut(ShortcutPath)
oShortCut.TargetPath = TargetPath
oShortCut.WorkingDirectory = WDirectory
oShortCut.WindowStyle = 1
oShortCut.Save
End If
End Function

Function CopyShortcut(ShortcutPath, Shortcut)
If Not (oFileSys.FileExists(DesktopPath + Shortcut)) Then
oFileSys.CopyFile ShortcutPath, DesktopPath, True
End If
End Function
**********************************************************
 
after trying all of the suggestions and having no success i went and worked on something else.

After a while i tested it again and it worked. I don't know if there is some sort of delay maybe the domain controller has to replicate...anyway, the last change that i made was in AD. Instead of placing the full file path in the profile i only used the file name.

Thanks for the help
 
sorry should have said that earlier. you only need to put the filename it automatically looks to the netlogon directory :)
 
I have posted ideas for troubleshooting logon script errors.

My first suggestion is to logon to a domain controller as an adminstrator and try and get the script working.

Here is the troubleshooting reference.

If there is a problem with script running but generating an error message then have a look here.
 
im also having problem with my .vbs logon script. it works well with win2k and winXP but not on other OS? can anyone help me? thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top