Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 284
  • Last Modified:

Windows Server 2003/2008 Logon scripts

I would like to know, is there a way to bypass logon scripts either for the administrator or for the servers?
0
schmad01
Asked:
schmad01
  • 5
  • 3
1 Solution
 
neothwinCommented:
For Administrators (or user accounts), you can remove logon script in AD.
If you want to skip the script on the servers, you can add some logics in the script. Normally these are conditional checking and jump statements (e.g. goto in batch script)

e.g.1
Let's say your server names are SERVER01, SERVER02, and so on and to skip running script on these servers in batch script:

==========
if /i "%computername:~0,6%"=="SERVER" goto END
.
.
your script body here
.
.
:END
==========

e.g.2
To skip only a server called ServerA:
if /i "%computername%"=="SERVERA" goto END
0
 
schmad01Author Commented:
I tried that with the below script, but it doesn't seem to be working for administrator.


Echo Please wait.....Preparing Logon Scripts
If "%username%" == "ofcstaff" GOTO ofcstaff
If "%username%" == "ralf" GOTO End
If "%username%" == "administrator" GOTO Admin
If "%username%" == "Administrator" GOTO Admin
If "%username%" == "benchmark" GOTO Admin
If "%computername%" == "MCBDC1" GOTO End
If "%computername%" == "MCBMS1" GOTO mcbms1
If "%computername%" == "2003-server" GOTO End
If "%computername%" == "main" GOTO End
If "%computername%" == "WORK-SERVER" GOTO End
If "%computername%" == "ralf-1" GOTO Admin
If "%computername%" == "ralf-2" GOTO Admin
If "%computername%" == "Station-5" GOTO End

REM --- DO EVERYTHING HERE
MCBdefault.bat
REM --- ETC
REM --- ETC

:ofcstaff
net use k: \\mcbdc1\clients /persistent:No


:Admin

net use y: \\mcbdc1\installs /persistent:No


:mcbms1
printerdefault.vbs
0
 
neothwinCommented:
pls use /i in if commands to use case insensitive.
And pls ensure logon script property is configured on Administrator user account.
0
What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

 
schmad01Author Commented:
Interesting, I've never seen that /i before.  What do you mean exactly in your second sentence.
0
 
schmad01Author Commented:
What do you mean by ensure logon script property is configured on Administrator user account? Thanks.
0
 
neothwinCommented:
The Administrator account is domain account? or local account? Pls check the logon script is configured on domain\administrator or local administrator account.
0
 
schmad01Author Commented:
Yes, domain account.
0
 
schmad01Author Commented:
Thanks alot.
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

Improve Your Query Performance Tuning

In this FREE six-day email course, you'll learn from Janis Griffin, Database Performance Evangelist. She'll teach 12 steps that you can use to optimize your queries as much as possible and see measurable results in your work. Get started today!

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