Will Wally said:
I need to specify a logon script name in the "logon script" field on the
profile tab for about 300 user accounts in Active Directory. How can I do
this without going into each account one at a time?
Will
You first need to compile a list of your users. This script will do it:
@echo off
net user | more +4 | find /i /v "successfully" >%temp%\users.1
if exist %temp%\users.2 del %temp%\users.2
for /F "tokens=1" %%n in (%temp%\users.1) do echo %%n>>%temp%\users.2
for /F "tokens=2" %%n in (%temp%\users.1) do echo %%n>>%temp%\users.2
for /F "tokens=3" %%n in (%temp%\users.1) do echo %%n>>%temp%\users.2
type %temp%\users.2 | sort > %temp%\users.txt
echo %temp%\users.txt now contains a list of all user accounts.
============
Note that the above process will not work properly if you have
accounts with embedded spaces.
Next you must modify the user list so that it contains only
those names for whom a logon script is appropriate.
Lastly, you need to run this command from a
Command Prompt:
for %%n in (%temp%\users.txt) do net
user %%n /scriptpath:netlogon.bat
(unwrap line)