Knowledge base article describing how to extract .msu files and automate installing them

The .NET Framework 3.5 installs service packs for the .NET Framework 2.0 and 3.0 behind the scenes as prerequisites.  On Windows Vista and Windows Server 2008, the .NET Framework 2.0 and 3.0 are installed as OS components, which means that the 2.0 and 3.0 service packs are delivered as .msu files that contain OS update metadata files and payload.

I was asked by a colleague today about how to view and extract the contents of the .NET Framework 2.0 SP1 and 3.0 SP1 .msu files and then automate the installation if needed.  An .msu file is essentially a .zip file, so in the past I have used standard .zip viewing tools (such as WinZip) to view the contents.

Fortunately, my colleague found a useful knowledge base article describing how to automate this type of scenario and I wanted to post a link to it here to hopefully make it easier to find.  You can check out the article at this location:

https://support.microsoft.com/kb/934307

To summarize the information in that article, you can use the following syntax to extract the contents of an .msu file.  I am using the .NET Framework 2.0 SP1 .msu file that is included as a prerequisite for the .NET Framework 3.5 in the below examples:

expand -f:* "NetFX2.0-KB110806-v6000-x86.msu" %temp%\netfx20sp1

After extracting the contents of the .msu file, you can install it by using Package Manager (pkgmgr.exe) with a command line like the following:

pkgmgr.exe /n:%temp%\netfx20sp1\Windows6.0-KB110806-v6000-x86.xml

Alternatively, you can use Windows Update Standalone Installer (wusa.exe) to directly install a .msu file without extracting it by using a command line like the following:

wusa.exe "NetFX2.0-KB110806-v6000-x86.msu" /quiet /norestart