PowerShell Scripts, Tips, Expert Advices, Forums, and Resources

image rotation

Welcome to PowerShell.com, the educational and community site for Windows PowerShell People. Get a quick overview.

Latest Forum Posts

01-20-2015 - Parsing a log file
01-26-2015 - Query AD for All Users with Attribs but excludes?
01-26-2015 - Disable user script check

Latest Scripts

01-23-2015 - Codename "steroid"
01-12-2015 - Test script
01-10-2015 - Change prompt on fly

Latest Blog Posts

01-26-2015 - Azure and Compliance
01-26-2015 - Cmdlets to Manage MSI Packages
01-26-2015 - Understanding Numbers in PowerShell

Latest Announcements/Events

10-31-2014 - Using PowerShell to download Teched Europe 2014 content
10-15-2014 - Class Dismissed
10-12-2014 - The Case for PowerShell

As a Powershell.com member you will have access to:

  • Daily PowerShell tips written by Microsoft MVPs and other leading Windows PowerShell experts
  • Free Windows PowerShell advice and training provided by Microsoft MVPs and other leading Windows PowerShell experts
  • Access to leading Windows PowerShell blogs
  • A free ebook, Mastering PowerShell, written by Microsoft MVP Dr. Tobias Weltner
PowerTip of the Day

Cmdlets to Manage MSI Packages

PowerShell 2.0 and later

Anyone who needs to manage MSI installer packages may benefit from an open source project found here: http://psmsi.codeplex.com/.

Simply download the PowerShell module – it comes as an MSI installer package itself. Make sure you unblock the MSI file before you install it (Unblock-File). Otherwise, Windows may refuse to install it.

Unfortunately, the module installs itself in a highly unusual location (AppData\Local\Apps\...), and extends $env:PSModulePath so PowerShell can find the module. This is why you need to restart PowerShell after module installation, because PowerShell will not pick up the changes to $env:PSModulePath.

This is how you can list the new MSI-related cmdlets:

 
PS> Get-Command -Module MSI

CommandType     Name                                               ModuleName
-----------     ----                                               ----------
Function        Get-MSIComponentState                              MSI
Function        Get-MSISharedComponentInfo                         MSI
Function        Install-MSIAdvertisedFeature                       MSI
Cmdlet          Add-MSISource                                      MSI       
Cmdlet          Clear-MSISource                                    MSI
Cmdlet          Edit-MSIPackage                                    MSI
Cmdlet          Export-MSIPatchXml                                 MSI
Cmdlet          Get-MSIComponentInfo                               MSI
Cmdlet          Get-MSIFeatureInfo                                 MSI
Cmdlet          Get-MSIFileHash                                    MSI
Cmdlet          Get-MSIFileType                                    MSI
Cmdlet          Get-MSILoggingPolicy                               MSI
Cmdlet          Get-MSIPatchInfo                                   MSI
Cmdlet          Get-MSIPatchSequence                               MSI
Cmdlet          Get-MSIProductInfo                                 MSI
Cmdlet          Get-MSIProperty                                    MSI
Cmdlet          Get-MSIRelatedProductInfo                          MSI
Cmdlet          Get-MSISource                                      MSI                            
Cmdlet          Get-MSISummaryInfo                                 MSI
Cmdlet          Get-MSITable                                       MSI            
Cmdlet          Install-MSIPatch                                   MSI                    
Cmdlet          Install-MSIProduct                                 MSI          
Cmdlet          Measure-MSIProduct                                 MSI                             
Cmdlet          Remove-MSILoggingPolicy                            MSI
Cmdlet          Remove-MSISource                                   MSI
Cmdlet          Repair-MSIProduct                                  MSI
Cmdlet          Set-MSILoggingPolicy                               MSI                  
Cmdlet          Test-MSIProduct                                    MSI
Cmdlet          Uninstall-MSIPatch                                 MSI
Cmdlet          Uninstall-MSIProduct                               MSI 
 

Twitter This Tip! ReTweet this Tip!

Copyright 2012 PowerShell.com. All rights reserved.