Δ
Useful Script of the Month
![bar1](http://eddiejackson.net/web_images/lightgraybar.bmp)
How to
rename a list of computers from a text file
Task:
Rename a fleet of workstations from a text file. The text file
contains computer old and new names.
For example the text file
(oldname, newname):
lab01,class01 lab02,class02 lab03,class03
Script:
@:: 1ST CREATE THE
COMPUTERS.TXT FILE - CONTAINS OLDNAME,NEWNAME COMPUTER NAMES @:: 2ND
UPDATE THE NETDOM COMMAND WITH THE PROPER CREDENTIALS
@Echo off
Title Administrative Computer Rename color 0a
::
--------------------------------------------------------------------------------------------------------------------------------
for /f "tokens=1,2 delims=," %%a in (computers.txt) do (
:: TEST FOR
ONLINE STATUS echo Loading workstation name... echo. ping -n 2
127.0.0.1>nul ping %%a | find "Reply" > nul if errorlevel 1 (echo
oldname:%%a,newname:%%b,OFFLINE >> "log.txt" ) else ( echo
oldname:%%a,newname:%%b,ONLINE >> "log.txt" echo Found %%a... echo.
ping -n 2 127.0.0.1>nul :: RENAME COMPUTER echo Renaming computer...
echo. netdom renamecomputer %%a /newname:%%b
/userD:DOMAIN\DOMAIN_ACCOUNT_NAME /passwordd: DOMAIN_ACCOUNT_PASSWORD
/usero:administrator /passwordo:LOCAL_ACCOUNT_PASSWORD /reboot:30 /force
ping -n 2 127.0.0.1>nul ) ) ::
--------------------------------------------------------------------------------------------------------------------------------
![bar1](http://eddiejackson.net/web_images/lightgraybar.bmp)
Δ Wednesday, February 27th,
2013
![bar1](http://eddiejackson.net/web_images/lightgraybar.bmp)
Δ
Enumerate All Users in a Domain
How to
return all usernames in a domain
[download resource files]
VBScript to create a text file listing the names of all users in the domain. The
file contains the NT name of each user, one name per line. The NT name is
called the pre-Windows 2000 logon name. It is the value of the
sAMAccountName attribute of the user. The sAMAccountName of any object must
be unique in the domain.
Δ
[email me]
![bar1](http://eddiejackson.net/web_images/lightgraybar.bmp) |
Δ Thursday, February 21st,
2013
![bar1](http://eddiejackson.net/web_images/lightgraybar.bmp)
Δ
Find Locked Out Users
How to
return all your locked out users
[download resource files]
VBScript demonstrating an efficient way to retrieve the names of all users that
are currently locked out. This program outputs the Distinguished Names of all
locked out users.
Δ
[email me]
![bar1](http://eddiejackson.net/web_images/lightgraybar.bmp) |
Δ Tuesday, February 19th,
2013
![bar1](http://eddiejackson.net/web_images/lightgraybar.bmp)
Δ
Move Inactive Computer Accounts
How to move computer accounts in active directory
[download resource files]
VBScript program to determine when each computer
account in the domain last had their password changed. If this date is more
than a specified number of days in the past, the computer object is
considered inactive and it is moved to a target Organizational Unit. The
computer account is also disabled. A log file keeps track of which computer
objects are moved.
Δ
[email me]
![bar1](http://eddiejackson.net/web_images/lightgraybar.bmp) |
Δ Friday, February 15th,
2013
![bar1](http://eddiejackson.net/web_images/lightgraybar.bmp)
Δ
Return User Account Info
How to
return user account information from active directory.
[download resource files]
VBScript to retrieve the password information for one user. The user
Distinguished Name is hard coded in the program. The program outputs the date
the user last changed their password, the domain maximum password age policy
in days, whether the user is allowed to change their password, and whether
the password is expired. The user is allowed to change their password if the
flag "User cannot change password" is not set, and the flag "Password never
expires" is also not set.
Δ
[email me]
![bar1](http://eddiejackson.net/web_images/lightgraybar.bmp) |
Δ Friday, February 1st,
2013
![bar1](http://eddiejackson.net/web_images/lightgraybar.bmp)
Δ
Reset The Local Password On
All Machines
How to reset the local password on your fleet
machines
EASY WAY - using
SCCM/LANDesk/Logon Script
HARD WAY
[download resource files]
VBScript to reset the local Administrator password on all workstations in the
domain to the same value. The program documents all activity, including
workstations that could not be contacted or on which the password could not
be reset, to a log file. The NetBIOS names of all computers where the
password was not reset are also written to a "missed" file. The next time
the program is run, only the computers listed in this file will be processed.
The program can be run repeatedly until this file is empty, meaning that the
local Administrator password has been reset on all workstations.
Δ
[email me]
![bar1](http://eddiejackson.net/web_images/lightgraybar.bmp) |
|
About
I'm a Computer Systems Engineer
Living and Loving Life
Author
|