JSI Tip 2793. How can I tell if a Windows NT/2000 installation was an upgrade or clean install?

When Windows NT or Windows 2000 is installed, %SystemRoot%\System32\$winnt%.inf is created. If you inspect the \[data\] section, using notepad, you can determine how the operating system was installed. Here is a sample $winnt$.inf file:

skipmissingfiles = "0"
unattendedinstall = "no"
floppylessbootpath = "no"
producttype = "winnt"
standardserverupgrade = "no"
winntupgrade = "no"
win9xupgrade = "no"
win31upgrade = "no"
sourcepath = "\device\cdrom0\"
floppyless = "0"
msdosinitiated = "0"
If all the parameters than end in upgrade are "no", the OS was a clean installation on a partion that had no existing operating system.

NOTE: If you subsequently perform an update install, winntupgrade may toggle to "yes".

Here is a sample Windows 2000 script, that uses NETDOM from the Support Tools, to query all member workstations.
The report is displayed on the console and written to %tmp%\upgrade.txt.

@echo off
for /f "Tokens=*" %%i in ('date /t') do set dte=%%i
for /f "Tokens=*" %%i in ('time /t') do set tme=%%i
@echo %dte% %tme% 
@echo %dte% %tme% >%tmp%\upgrade.txt
for /f "Skip=1 Tokens=1,2" %%i in ('netdom query workstation') do call :mbr %%i %%j
goto end
if "%1"

"The" goto done1 :mbr1 set cname=%1 if not exist \\%cname%\c$\winnt\system32\$winnt$.inf goto end set dp=N for /f "Skip=3 Tokens=*" %%i in (\\%cname%\c$\winnt\system32\$winnt$.inf) do call :parse "%%i" goto end :done1 if "%2"

"command" goto end goto mbr1 :parse if "%dp%"

"Y" goto end set string=%1 set string=%string:"=% set wrk=%string:upgrade=% if "%string%"

"%wrk%" goto end set wrk=%string:dospath=% if not "%string%"=="%wrk%" set dp=Y&goto end @echo %cname% %string% @echo %cname% %string% >>%tmp%\upgrade.txt :end

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.