Jump to content

- - - - -

Script to reinstall automatically all the applications of a Windows damaged installation.

  • Please log in to reply
No replies to this topic

#1 Marietto


    Frequent Member

  • Advanced user
  • 268 posts
  • Location:Italy
  • Interests:Computers,movies,read/write,talking about philosophy and religion.

Posted 03 November 2010 - 02:49 PM

Hello to everyone,

sometimes can happens that Windows is really damaged,or better,that the registry is very corrupted that the best thing to do is to make a fresh installation,right ? Since there are a *free* tools to backup/export and reimport the user profiles (USMT 4 from ms) and the drivers (taking the updated drivers from a database and reimport them with dpinst) from the old windows installation to the new one,there is no safe way AFAIK to use the previous applications because the Program Files folder could be infected by virus. The best way could be to delete it and install them again from the beninning. So,is for this reason that I would like to start this project,because I could have found a good starting point to do it without to be a skilled coder,like I'm not. The first thing to do is to have a list of the applications installed in Windows while it is offline,because we should think that is unabled to boot again. I've googled for a while and I found this script (credit goes to Torgeir Bakken). Before to use it we have to :

Step 1: Copy the system’s registry hive to our analysis system
Step 2: Mount the registry hive in regedit.exe,calling it old_applications
Step 3: Navigate to the OS version in regedit.exe
Step 4: Unmount the registry hive.
Step 5: Open a command prompt and then do : CSCRIPT installed.vbs .

This is the code :

' [installed.vbs]
' Run this script with the command:
' CSCRIPT installed.vbs <name_or_ ip-address>
' use "." for local computer

' Script author: Torgeir Bakken

sComputer = WScript.Arguments.Item(0)

wscript.echo InstalledApplications(sComputer)

Function InstalledApplications(node)
Const HKLM = &H80000002 'HKEY_LOCAL_MACHINE\old_applications
Set oRegistry = _
GetObject("winmgmts:{impersonationLevel=impersonate}!\\" _
& node & "/root/default:StdRegProv")
sBaseKey = _
iRC = oRegistry.EnumKey(HKLM, sBaseKey, arSubKeys)
For Each sKey In arSubKeys
iRC = oRegistry.GetStringValue( _
HKLM, sBaseKey & sKey, "DisplayName", sValue)
If iRC <> 0 Then
oRegistry.GetStringValue _
HKLM, sBaseKey & sKey, "QuietDisplayName", sValue
End If
If sValue <> "" Then
InstalledApplications = _
InstalledApplications & sValue & vbCrLf
End If
End Function

' From: Torgeir Bakken
' http://www.mvps.org/.../bakkenalia.htm

Now that we have a good list of software to reinstall,we should know where to grab it,maybe from Internet,if the installed applications on the old Windows system was a few,or from a DVD or a remote location. Anyway,we need to write a script that,starting from the names of the applications,it is able to build an XML file (later reading you will understand) containing all the locations of the setup installers. Is here that could be need your help.

The third step could be to use a free for personal use only tool named :


It is nice because (from the webpage) it takes a list of your favorite programs and will download and install the ones you pick. It doesn't need to ask any questions, so you can go do more important things. InstallPad can resume downloads you've canceled, and can even try and find the latest version of your program online.

The 4 step could be to backup all the serial numbers contained on the old Windows registry and importing on the new one. It's enough,I hope that you find this project useful and that you can help by improving it. Thanks.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users