Changing SID in Windows 2000

In most Windows 2000 networks it is ideal for the computer to have unique SID's. Just changing the name of the system is rarely enough. For those of you that have identical systems and would like to clone the system without dealing with Microsoft's sysprep utility using ghost or something similar there is a great "free" utility that you can run.

The utility is called newsid and can be downloaded from:

Sysinternals Freeware

My recommendation would be prepare a machine for ghost but before dumping the image prep the machine to login automatically to an administrator account and run newsid. If you use newsid from a batch file you can give it the /a switch to run automatically and reboot. You can also rename the machine using newsid by running

newsid /a newname

where newname is the name you would like your system changed to. A simple batch file and registry key can do the rest (ie: set the identify script to run from the registry and then remove it from the registry while it is running)

There are several batch files that we have created for labs and such but they mostly depend on what you would like to do with it. We will add another tutorial on helpful Windows 2000 batch files.

Joining a Domain from command line:

If you are like us and have cloned large groups of systems that login to a domain you have most likely run into the issue of not being able to login to the domain after ghost. One option is to manually reconnect to the domain but another option is to have it reconnect automatically.

Microsoft Windows 2000 support tools comes with a command line utility called netdom. This utility allows you to join or remove a system to a domain. After a ghost simply run this command line utility to remove itself if connected and then join again.

Note: If you are changing the SID using newsid you must allow the machine to reboot first before attempting this. Also, you can not run it right away as you need to wait for the rest of the system processes to complete successfully.

An example of a command line would be:

c:\netdom remove machinename /domain:domainname
c:\netdom join machinename /domain:domainname

You may need to provide a different username and password to connect and you have to be logged in as an administrator.

For suggestion on how to script this using a batch find consult our sample batch files available in our tutorials.

Get IP address from command line:

Here is a sample of a simple batch file that will give you the ipaddress of a windows 2000 machine using built in windows 2000 functions:

@echo off

ECHO Finding IP Address...
ipconfig /all > ipconf
for /f "tokens=1* delims=:" %%i in ('type ipconf') do call :FINDMAC "%%i" "%%j"
goto END

if %1=="" goto END
set field=%1
set field=%field: =%
set field=%field:.=%
set field=%field:~2,99%
set field=%field:"=%
if /i %field%==PhysicalAddress goto GETMAC
goto END

set MACADD=%2
del ipconf > nul

:: Now you can simply do what you like with the IP
echo %MACADD%
echo %MACADD% >> IPADDRESS.txt