Discussion Locked

Disable logon scripts just for servers?

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

I have a logon script for when I logon to workstations, that basically maps drives. Is there away with a policy to disable the logon script for when I logon to any server domain controller? I have a mix of windows 2000 and 2003 domain controllers.

Thanks in advance!

4 replies

by x-marcap

Set up as a local administrator on the box for the one where you map the world, or maybe less authority. Maybe, power user is enough for non-admin tasks.

Set up the domain admin accounts disable the administrator account and depending upon how many servers you have, set up local admin accounts.
if your initials are xyz
admLxyz admDxyz, etc...

Good luck

Tim

by truwarrior22

I guess I could add a statement in the logon script with an IF statement or something. Like IF hostname = server1 or server2 then skip to end etc...

Any thoughts on that?

by thefrown

Create a text file (with the same name) on the C: of each server. Then put in your logon script an 'if exist' (followed by full path and name of file in quotes) and 'goto' clause to skip your drive mappings.

Alternatively, create an administrative domain account for use whilst working on servers that has no login script applied to it. Then remove the administrative rights to your normal account that you use for email, word processing etc. (this is actually what Microsoft recommend)

by sam spade

WMI can be used to determine if you have logged onto a workstation, member server, domain controller, etc. So if its not a workstation you could just quit before mapping drives.

Below is some code taken from a Hey, Scripting Guy! article to give you the general idea. The full article is here -> http://www.microsoft.com/technet/scriptcenter/resources/qanda/jan06/hey0117.mspx

strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Set colComputers = objWMIService.ExecQuery _
("Select * from Win32_ComputerSystem")

For Each objComputer in colComputers
If objComputer.DomainRole < 2 Then
Wscript.Echo "This is a workstation."
Else
Wscript.Echo "This is a server."
End If
Next

This discussion is closed to new replies.