Logon Script

By msft ·
Hi all,

I am just currently creating a batch logon script for a SBS box. I have been able to successfully create the basic script such as the "net use" commands etc for network drives. However, my boss wants a script inside it that says "If [COMPUTERNAME] THEN do not run script". Can anybody help me write this? Thanks. It should be a Windows Batch File (i.e. runs in Command Prompt cmd.exe)

Thanks all

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Answers

Collapse -

Here ya go

by Churdoo In reply to Logon Script

Rem do stuff here
Rem skips down to here

Or you may want to look into using Group Policy to assign the login scripts to computer objects by OU, and you can assign different scripts to different computers based on their OU placement.

Collapse -

If you don't want to get into GPOs

by neilb@uk In reply to Logon Script

and have more than one computer that doesn't want a Login script, put those computer names in a file, one per line, and use the following bit of batch file logic. The batch file will read through the computer names file and if it finds the local machine, will exit.
@echo off
For /F %%i in (\\pathtofile\computers.txt) DO If "%COMPUTERNAME%"=="%%i" GOTO Exit
Rem Do your login bits here
Rem .
Rem .
This will let you easily modify a central list.

Neil :)

Related Discussions

Related Forums