Archive

Posts Tagged ‘Scripts’

Upgrading MSI’s with MSP’s

Some software vendors release updates in the form of MSP files. These patches cannot be deployed via Active Directory, but they can be applied to the original MSI and then re-deployed as a new package. For this example we’ll update Acrobat Reader 9.1.0 to 9.1.3. This process can be used on any application that uses msp patch files (like the newer Acrobat Reader 9.3.1), but 9.1 makes a good example becuase there is a series of two patches required to get to 9.1.3.

Fetch the Installer

First, obtain the full MSI installation file for the version the application that the MSP is meant to patch. Adobe makes it pretty straight forward for Acrobat Reader, just browse their FTP starting at ftp://ftp.adobe.com/pub/adobe/reader/win/ to navigate to the latest version. For this example, we want to pull the AdbeRdr910_en_US.msi from /9.x/9.1/enu/

Fetch the Patch(es)

Now grab the MSP patch files and save them to the same location that you put the MSI. In this case, 9.1.0 cannot go straight to 9.1.3, because you have to patch to 9.1.2 as first, so grab both MSP files.
ftp://ftp.adobe.com/pub/adobe/reader/win/9.x/9.1.2/misc/AdbeRdrUpd912_all_incr.msp
ftp://ftp.adobe.com/pub/adobe/reader/win/9.x/9.1.3/misc/AdbeRdrUpd913_all_incr.msp

Apply the Patch(es)

Open a command prompt and apply the patches to the MSI by using MSIExec. You just need to use the /a switch to specify the application MSI file and the /p switch for the patch. If you have more than one patch, be sure to apply them in the correct order. Also keep in mind that this will alter the MSI file, so you may want to make a copy of it as a backup if you need to keep the original version around.

msiexec /a AdbeRdr910_en_US.msi /p AdbeRdrUpd912_all_incr.msp
msiexec /a AdbeRdr910_en_US.msi /p AdbeRdrUpd913_all_incr.msp

Rename the Updated MSI

The MSI file now contains the version of the application that you have applied, but the filename has not been changed to reflect that. It’s a good idea to rename the msi now so things don’t get confusing about what’s what.

move AdbeRdr910_en_US.msi AdbeRdr913_en_US.msi

Create a Transform (optional)

The last step would be to generate a Transform file (an .MST file) which is essentially a list of answers to the questions that might be asked during the install. Often times you can also make more advanced changes to the installation such are registry edits and file exclusions using a transform. For Acrobat Reader, Adobe has a nice (and free) tool called the “Adobe Customization Wizard” that does a great job of helping you generate it’s MST file.

Install it

Now you can install the application! Just double click it, or if you have an MST you can install from command line or a script. This is how you can do a silent install.

msiexec /i AdbeRdr913_en_US.msi TRANSFORMS=AdbeRdr913_en_US.mst /qb!

Or you can get real fancy and install the new MSI package from Active Directory and deploy it via Group Policy.

Making iSCSI Targets via CMD

Adding iSCSI targets can be cumbersome when you have several volumes on the SAN and several network cards in several hosts.  At Orion there were 8 hosts with 4 NICs and 8 volumes to connect too.  That’s 256 iSCSI connections, and if you use the GUI to make these connections, then you’re talking about doing at least 15 clicks per connection (3840 total) and then try to keep everything straight.  Good luck!   

Rather than clicking 4,000 times (taking into account a few mistakes) I wrote a script that uses a command that Nate gave me to make a Multipath IO connection with iscsicli.exe.  It’s easy to use and should work on any flavor of Windows that uses Microsoft’s iSCSI Initiator (2008 Standard, Core, Hyper-V Server R2, Enterprise, Windows 7, etc).  You just need to discover what “position” your network iSCSI cards are in to prepare the script.   

First, log in to the server and from command line run “iscsicpl” to open the control panel.  Select any target, click Connect and then Advanced.  From here select the Microsoft iSCSI Initiator and then pull down the Initiator IP drop down list.  Use the screenshot below to determine what “Position ID” your iSCSI NICs use.  Then hit Cancel a couple times to back out without making changes.   

    

Now you can edit iSCSINICs.txt to list only the ID’s for each NIC that you want to connect.  Put one number per line for each NIC.  In this example, because the 172.16.0.* NIC’s are being used for iSCSI, you would use:  

5
6
7
8

I do not understand where the order for this list comes from, so I can’t explain why it is listed that way, but I can tell you that if you make changes to your network hardware (like a driver update or share the nic with a virtual network) the order can and likely will change and you’ll have to re-create the iSCSI connections.  So try to get that stuff settled before bothering with this too much.  

Next you can edit iSCSITargets.txt to list each of the iSCSI targets that you want to connect those NICs to.  For example:  

iqn.2001-05.com.equallogic:0-8a0906-d7899e704-8ba0000000b4b437-hv-hio-csv02
iqn.2001-05.com.equallogic:0-8a0906-f5b99e704-1860000000e4b437-hv-mio-csv02
iqn.2001-05.com.equallogic:0-8a0906-fc599e704-20a000000104b437-hv-mio-csv03
iqn.2001-05.com.equallogic:0-8a0906-ff199e704-bbc000000124b437-hv-mio-csv04
iqn.2001-05.com.equallogic:0-8a0906-01999e704-002000000144b438-hv-mio-csv05
iqn.2001-05.com.equallogic:0-8a0906-06799e704-ade000000164b438-hv-mio-csv06

You can pull the target names from the “Discovered Targets” list in iscsicpl by copying it from the “Connect to Target” window or copying it from the Properties page.  

Finally, save the txt files and run the makeTargets.cmd script.  It’ll loop through the list of targets and make a Multi-Path (MPIO) enabled connection for each NIC to it.  Repeat this process on each host.  Make sure to check the NIC ID’s, but you’ll likely only need to get the Targets once. 

@echo off
ECHO.
ECHO Create MPIO "Favorite Targets" for each Nic and Target in the txt files...
Pause
ECHO.</pre>
FOR /F %%T IN (iSCSITargets.txt) DO (
 echo %%T
 FOR /F %%N IN (iSCSINICs.txt) DO (
  echo Targeting Network Interface %%N
  iscsicli persistentlogintarget %%T T * * * %%N * 0x00000002 * * * * * * * * * 0
  REM Sleep for one second, just to let things sort of settle...
  PING -n 2 127.0.0.1>nul
 )
) 

start iscsicpl

Now that they are connected, your next task it to initialize the volume and create a partition…

Categories: Scripts Tags: ,