Huntland Services Ltd

Tel: +44 (0)1392-490518
Fax: +44 (0)1392-428003
Enquiries@huntland.co.uk

Modify a Remote Source List

Back Download The Script

 

Introduction

An msi installed product 'remembers' from where it was originally installed.  This is needed to support MSI features such as install on demand and resiliency.  For example, if a file needed for the product becomes accidentally damaged or missing, the MSI service will use the original source to re-run the installation and recover the file.  In addition it can make use of a back up list of alternative sources for the same installation in case the original has itself become damaged or unavailable.

The original source and any alternatives, collectively constitute the SourceList.  Normally it is impossible to alter this list after the product has been installed.  The API's supplied by the installer service can succeed in modifying the list but the modifications will be ignored.  Furthermore these modifications cannot be performed remotely.

Where this is particularly relevant is where users of mobile computers move from one network to another frequently.  Products installed sucsessfully at home base then give problems when the user can no longer access the original source.  Typically a user may phone in from a remote site where a product running on their laptop has failed to perform install-on-demand.   They may not have realised that when the product was installed, not all the features were installed.  They are installed as and when they are requested.  In this way the installer may be trying to perform a legitimate operation on behalf of the user and fails because the original server is not available.

Another aspect of the same problem is that when moving about, it may be advantageous to fetch the desired installation from a local server.

Software deployment tools such as SMS or Win2k/DotNet Publish/Assign can rollout products to a mass audience but will still be subject to the underlying Installer Service behaviour.

Solution

Amend the Source List remotely and interactively

  1. Force the Installer to use a new source for the product
  2. Force the Installer to use a list of alternative sources arranged in the correct sort order to match the availability of local servers

Potential alternative sources include Floppy Disks, CD/DVD's, URL's or local drives and web sources using http.

 

Usage

cscript.exe ModifyRemoteSourceList.vbs Server1 Server2 C:\temp\changeLog.log

Where:

Server1 The name or IP Address of the target system
Server2 The name or IP Address of the Domain Controller
C:\Temp\ChangeLog.Log  An arbitrarily named text file for recording changes made

Notes:

You must have local administrator privileges on the target system and the domain controller.  Your system must have MDAC and all other systems must have MSI Installer version 2.0 or above and WMI.  e.g. Win2k or above

Operation

Start the script from the command line.  A short pause ensues while connections are made to the two servers.  Next you will be presented with a list of all the MSI installed products on the target system.  This list may be very long.  You may have to adjust the screen resolution and Command Prompt window properties to make this comfortably visible.

productList image

Notice how the display resolves the 'owners' of each product so you can see who has installed what.  This is important because you cannot modify the Source List if the user is not currently logged on.  You will therefore only be able to modify the current user's products or those installed for 'all users'.  The latter appear listed under the local system account (as above).

You will be prompted to select which product you want to modify by choosing its number from the list (Left hand margin).  The result is a display of the Source List for this product and you are invited to chose whether to Add, Edit or delete an entry.

sourceList_1 image

Notice how the Source List is in Search order.  If the Installer cannot find the installation at the location given by the Last Used Source (n;1;D:\mySource1\) then it will try all the entries in the Source List until it succeeds in the order shown.  The default behaviour is Network, then Media, then Url.  In this case the user's policy has been set to Network,Url then Media.  Notice also the syntax used by the Last Used Source entry - (n;1;D:\mySource1\)  - means -  n = Net, 1 = the first in rank within Net, and finally the path D:\mySource1\.  This is a local partition but they are classified as Network any way.

When you chose which operation you want you can make your alterations:

Add

You are prompted to enter the new Source List entry.  To make this simple, you must use the same syntax as the Last Used Source discussed above.  The only difference is that the rank you enter will be ignored as whatever you add is inserted at rank 1 for a particular Source Type (Net, Media, Url) and the existing ones are shunted down.  So for example to add a new Url source for www.huntland.co.uk/mySource4/ use

u;1;http://www.huntland.co.uk/mySource4/

Other examples are:

F:\Folder1\Folder2\mySource\  n;1;F:\Folder1\Folder2\mySource\
\\Sever23\Folder1\mySource  n;1;\\Sever23\Folder1\mySource
Cd 'MyDisk' in drive Y: m;1;MyDisk;Y:\Folder1\mySource

The result ,showing the new search order which by now includes your addition, is displayed:-

sourceList_2 image

 

You will be prompted to chose another operation or hit cancel to move on

Edit

Once you have chosen the Edit option you will be prompted to select the individual Source List entry by entering the appropriate Search Order number (Left margin.).  Next you will be presented with your selected Source List to edit.  In this example the server 'DistribServer' is replaced with 'OtherServer'

editList image

Notice that you can only edit the Source List path, not its rank or search order.  To effectively shuffle the order of precedence you must make multiple edits.

editList_2 image

 

Delete

After you have chosen the Edit option you will be prompted to select the individual Source List entry by entering the appropriate Search Order number (Left margin.).  Next you are invited to select which Source List entry to delete by entering the appropriate Search Order number (left hand margin).  In this example Search Order 3 is selected in order to delete the entry 'http://www.huntland.co.uk/mySource4/'. 

editList_3

Finally you are asked to confirm deletion.    Notice how the Source List ranking is re-arranged i.e. what was Url 2 now becomes Url 1.

editList_4 image

 

Change the Last Used Source List

After performing any of the three operations you will be invited to modify the Last Used Source.  This is not compulsory.  The Last Used Source entry is the first one the installer attempts before resorting to the default search order.  If the user will be returning to their own network eventually you may want to leave this unchanged.

As before the Last Used Source syntax must be used.  In this example, the entry is set to the new url just added.  You can copy and paste this from the input boxes or the Command Prompt window

u;1;http://www.huntland.co.uk/mySource4/

The final result is displayed:-

sourceList_3 image

Finally...

The script is essentially making remote modifications to the Registry using WMI.  Any modification to the Registry attracts a certain amount of risk and doing it remotely even more so.  Therefore you should be careful how you use this tool and be certain any modifications you make are valid ones.  This requires a modicum of understanding of the Windows Installer and how it uses the Source List.  Information for this can be found in the Windows Platform SDK Windows Installer section.

Please accept the script as is.  Any feed back will be gratefully received at Debug@huntland.co.uk