GithubHelp home page GithubHelp logo

heaths / psmsi Goto Github PK

View Code? Open in Web Editor NEW
144.0 26.0 20.0 3.05 MB

Windows Installer PowerShell Module

License: MIT License

PowerShell 1.55% C# 98.16% Makefile 0.14% C++ 0.15%
powershell windows-installer msi msp mst

psmsi's Introduction

Windows Installer PowerShell Module

Build Status: develop GitHub Release: Latest GitHub Releases: All PowerShell Gallery

Exposes Windows Installer functionality to PowerShell, providing means to query installed product and patch information, and to query views on packages.

Description

PowerShell is a powerful command shell that pipes objects - not just text. Because of this ability, you can string practically unrelated commands together in many different ways to work on different types of objects, all built on .NET. You can use all the properties and methods of those objects passed through the pipeline instead of being limited by the text sent to you as with traditional command shells.

This Windows Installer module for PowerShell provides cmdlets ("command-lets") - similar to functions - to query package states, patches registered and applied to products, and more. You can use it to query Windows Installer products and patches installed on your system.

get-msiproductinfo | where { $_.Name -like '*Visual Studio*' }

You can even use it to determine which products installed a particular file on your system.

get-msicomponentinfo `
    | where { $_.Path -like 'C:\Program Files\*\Common7\IDE\devenv.exe'} `
    | get-msiproductinfo

You can also install, repair, and uninstall products and patches complete with progress information, and warnings and errors direct to the pipeline.

install-msiproduct .\example.msi -destination (join-path $env:ProgramFiles Example)

Installation

Starting with 3.0, the easiest way to install the module with Windows 10 or the Windows Management Framework 5.0 or newer is by using the PackageManagement module.

# Specifying the provider is recommended, though may be "psgallery" on Windows 10 RTM.
install-package msi -provider PowerShellGet

You can also download the NuGet and Windows Installer packages directly from Releases.

License

The Windows Installer PowerShell module is licensed under the MIT License.

psmsi's People

Contributors

heaths avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

psmsi's Issues

How to import from path?

I've saved this module to a folder and am trying to import it from that folder. What is the correct file to reference to import it?

I've tried pointing to the PSM1 and it doesnt load

PS C:\temp\psmsistuff> Import-Module .\msi\MSI\3.2.33\MSI.psm1
Unable to find type [Microsoft.Tools.WindowsInstaller.PowerShell.Module].
At C:\temp\psmsistuff\msi\MSI\3.2.33\MSI.psm1:191 char:1
+ [Microsoft.Tools.WindowsInstaller.PowerShell.Module]::Use()
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (Microsoft.Tools...werShell.Module:TypeName) [], RuntimeException
    + FullyQualifiedErrorId : TypeNotFound

I've also tried importing the PSD1, and it loads but I dont see the commands referenced in the readme.

PS C:\temp\psmsistuff> Import-Module .\msi\MSI\3.2.33\MSI.psd1

PS C:\temp\psmsistuff> get-module

ModuleType Version    Name                                ExportedCommands                                                                                                                                                         
---------- -------    ----                                ----------------                                                                                                                                                         
<snip>
Script     0.0        MSI                                 {Get-MSIComponentState, Get-MSISharedComponentInfo, Install-MSIAdvertisedFeature}                                                                                        
<snip>

PS C:\temp\psmsistuff> get-command -Module msi
CommandType     Name                                               Version    Source                                                                                                                                               
-----------     ----                                               -------    ------                                                                                                                                               
Function        Get-MSIComponentState                              0.0        MSI                                                                                                                                                  
Function        Get-MSISharedComponentInfo                         0.0        MSI                                                                                                                                                  
Function        Install-MSIAdvertisedFeature                       0.0        MSI     

How can I import this from a specific folder that is not ever going to be in the $PSModulePath?

Invalid Win32-FileTime

Invoking Get-MSISummaryInfo on some MSI i get the error mentioned below. The same MSI can be opened by Orca without errors.
Create/Modify/Last Access date of the MSI is correct and a valid date.

Get-MSISummaryInfo : Ungültige Win32-FileTime.
Parametername: fileTime
In U:\PS1\MSIQSCheck.ps1:151 Zeichen:17
+ $TableSummary = Get-MSISummaryInfo -Path $msi
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-MSISummaryInfo], ArgumentOutOfRangeException
    + FullyQualifiedErrorId : System.ArgumentOutOfRangeException,Microsoft.Tools.WindowsInstaller.PowerShell.Commands.GetSummaryInfoCommand

get-msisummaryinfo : A share violation has occurred

After installing from PSGallery I am getting this error when trying to use get-msisummaryinfo. I'm not sure what this means. Is there a step I am missing?

PS > Install-Package msi

Name                           Version          Source           Summary
----                           -------          ------           -------
MSI                            3.2.33           PSGallery        Exposes Windows Installer functionality to Windows ...


PS > get-msisummaryinfo
get-msisummaryinfo : A share violation has occurred
At line:1 char:1
+ get-msisummaryinfo
+ ~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotImplemented: (:) [Get-MSISummaryInfo], PSNotSupportedException
    + FullyQualifiedErrorId : NotSupported,Microsoft.Tools.WindowsInstaller.PowerShell.Commands.GetSummaryInfoCommand

WIN7 loads module, but several cmdlets missing

EDIT: Closing issue, as apparently I had a very old renamed version of your MSI module buried in my modules. Still fighting with VS2017 hopefully after a full day of lost time it will simply be installed! :)

Can not download installer

I downloaded a msi from http://psmsi.codeplex.com/.
From the site https://github.com/heaths/psmsi I can download a project only or install github.
I tried to open a project with VS 2015 community but I got message that this version not supported

Unsupported
This version of Visual Studio is unable to open the following projects. The project types may not be installed or this version of Visual Studio may not support them.
For more information on enabling these project types or otherwise migrating your assets, please see the details in the "Migration Report" displayed after clicking OK.
- Module, "D:\Downloads\WindowsUpdateMiniTools\psmsi-master\psmsi-master\src\Setup\Module.wixproj"

No changes required
These projects can be opened in Visual Studio 2015, Visual Studio 2013, Visual Studio 2012, and Visual Studio 2010 SP1 without changing them.
- Setup, "Setup"
- PowerShell, "D:\Downloads\WindowsUpdateMiniTools\psmsi-master\psmsi-master\src\PowerShell\PowerShell.csproj"
- PowerShell.Test, "D:\Downloads\WindowsUpdateMiniTools\psmsi-master\psmsi-master\test\PowerShell.Test\PowerShell.Test.csproj"
- .nuget, ".nuget"
- Psmsi, "D:\Downloads\WindowsUpdateMiniTools\psmsi-master\psmsi-master\Psmsi.sln"Unsupported
This version of Visual Studio is unable to open the following projects. The project types may not be installed or this version of Visual Studio may not support them.
For more information on enabling these project types or otherwise migrating your assets, please see the details in the "Migration Report" displayed after clicking OK.
- Module, "D:\Downloads\WindowsUpdateMiniTools\psmsi-master\psmsi-master\src\Setup\Module.wixproj"

No changes required
These projects can be opened in Visual Studio 2015, Visual Studio 2013, Visual Studio 2012, and Visual Studio 2010 SP1 without changing them.
- Setup, "Setup"
- PowerShell, "D:\Downloads\WindowsUpdateMiniTools\psmsi-master\psmsi-master\src\PowerShell\PowerShell.csproj"
- PowerShell.Test, "D:\Downloads\WindowsUpdateMiniTools\psmsi-master\psmsi-master\test\PowerShell.Test\PowerShell.Test.csproj"
- .nuget, ".nuget"
- Psmsi, "D:\Downloads\WindowsUpdateMiniTools\psmsi-master\psmsi-master\Psmsi.sln"

Cannot load in PowerShell 6 (PowerShell Core)

After installing the module in PowerShell Core, loading the module fails with:

> ipmo msi
ipmo : The following error occurred while loading the extended type data file: ,
C:\Users\heaths\Documents\PowerShell\Modules\msi\3.2.3.1024\MSI.types.ps1xml(679) : Error in type "Microsoft.Tools.WindowsInstaller.Record": The "Type" node must have "Members", "TypeConverters", or "TypeAdapters".
, C:\Users\heaths\Documents\PowerShell\Modules\msi\3.2.3.1024\MSI.types.ps1xml(705) : Error: Unable to find type [Microsoft.Tools.WindowsInstaller.PowerShell.RecordPropertyAdapter].
, C:\Users\heaths\Documents\PowerShell\Modules\msi\3.2.3.1024\MSI.types.ps1xml(698) : Error: CodeProperty should use a getter or setter method.
, C:\Users\heaths\Documents\PowerShell\Modules\msi\3.2.3.1024\MSI.types.ps1xml(699) : Error: Unable to find type [Microsoft.Tools.WindowsInstaller.PowerShell.RecordPropertyAdapter].
, C:\Users\heaths\Documents\PowerShell\Modules\msi\3.2.3.1024\MSI.types.ps1xml(691) : Error: CodeProperty should use a getter or setter method.
, C:\Users\heaths\Documents\PowerShell\Modules\msi\3.2.3.1024\MSI.types.ps1xml(692) : Error: Unable to find type [Microsoft.Tools.WindowsInstaller.PowerShell.RecordPropertyAdapter].
, C:\Users\heaths\Documents\PowerShell\Modules\msi\3.2.3.1024\MSI.types.ps1xml(684) : Error: CodeProperty should use a getter or setter method.
, C:\Users\heaths\Documents\PowerShell\Modules\msi\3.2.3.1024\MSI.types.ps1xml(685) : Error: Unable to find type [Microsoft.Tools.WindowsInstaller.PowerShell.RecordPropertyAdapter].
, C:\Users\heaths\Documents\PowerShell\Modules\msi\3.2.3.1024\MSI.types.ps1xml(625) : Error: Unable to find type [Microsoft.Tools.WindowsInstaller.PowerShell.AttributeColumnTypeConverter].
, C:\Users\heaths\Documents\PowerShell\Modules\msi\3.2.3.1024\MSI.types.ps1xml(622) : Error: Unable to find type [Microsoft.Tools.WindowsInstaller.PowerShell.AttributeColumnPropertyAdapter].
, C:\Users\heaths\Documents\PowerShell\Modules\msi\3.2.3.1024\MSI.types.ps1xml(54) : Error in type "System.IO.FileInfo": The "Type" node must have "Members", "TypeConverters", or "TypeAdapters".
, C:\Users\heaths\Documents\PowerShell\Modules\msi\3.2.3.1024\MSI.types.ps1xml(66) : Error: CodeProperty should use a getter or setter method.
, C:\Users\heaths\Documents\PowerShell\Modules\msi\3.2.3.1024\MSI.types.ps1xml(67) : Error: Unable to find type [Microsoft.Tools.WindowsInstaller.PowerShell.FileInfo].
, C:\Users\heaths\Documents\PowerShell\Modules\msi\3.2.3.1024\MSI.types.ps1xml(59) : Error: CodeProperty should use a getter or setter method.
, C:\Users\heaths\Documents\PowerShell\Modules\msi\3.2.3.1024\MSI.types.ps1xml(60) : Error: Unable to find type [Microsoft.Tools.WindowsInstaller.PowerShell.FileInfo].
At line:1 char:1
+ ipmo msi
+ ~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Import-Module], RuntimeException
    + FullyQualifiedErrorId : FormatXmlUpdateException,Microsoft.PowerShell.Commands.ImportModuleCommand

Add-Type -Path <assembly path> is not failing to add any DTF assembly, but types therein are not enumerable or accessible within PowerShell Core. DTF would have to be .NET Core -compatible.

command not recognized in powershell after install psmsi.msi on windows 7

3.0.3+1 (Build 46) is the one I tried.

No indication in install instructions of needing to set a path or other configuration of powershell. I have attempted both all/single with and without admin elevation.

Install, open a powershell, get "the term .... not recognized" for commands such as get-msiproductinfo.

Sorry if this is not the best route to ask this question. Seems it was this or a comment on your blog. Am I missing something that powershell experts "just know" to do?
Thanks!

set target/destination not effect with install-msiproduct

Hello,thanks for your great job.
I want to install redis using a Redis-x64-3.2.100.msi on my WindowsServer 2012R2 with WMF5.1.
I execute the cmd below in powershell:

$src='C:\ps\src\Redis-x64-3.2.100.msi'
install-msiproduct $src -destination C:\install\redis -log C:\ps\src\install.log

When done,the destination of redis is "C:\Program Files\Redis",not the "C:\install\redis" as my set.
Here is my install log:
install_20180730023825_000_Redis-x64-3.2.100.log

Did I miss something?
Please give me a help,thanks a lot!

Unable to install directly from URL

Install-MSIProduct -Path https://github.com/PowerShell/PowerShell/releases/download/v6.2.0-preview.2/PowerShell-6.2.0-preview.2-win-x64.msi

Error: Install-MSIProduct : Cannot find drive. A drive with the name 'https' does not exist. At line:1 char:1
+ Install-MSIProduct -Path https://github.com/PowerShell/PowerShell/rel ...
+ CategoryInfo : ObjectNotFound: (https:String) [Install-MSIProduct], DriveNotFoundException
+ FullyQualifiedErrorId : DriveNotFound,Microsoft.Tools.WindowsInstaller.PowerShell.Commands.InstallProductCommand

I Get the same error while using the -LiteralPath parameter.

Compare-MSIPackage

Seems a useful cmdlet would be to compare databases based on MsiDatabaseGenerateTransform, and for each table dump records where MSIOperation -ne 'None', using existing functionality. An ideal output format may be a grouping per table, which should allow to display different table schemas in a way that looks intuitive.

Unable to find package MSI: How to install?

I was unable to find the package MSI. I run Windows 7, Powershell 5.

PSVersion 5.0.10586.117
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.10586.117
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

I am on Windows 7 and must struggle with Powershell parts that haven't been written to work on Windows 7, only Windows 10 etc.

I suppose I can install another way, just downloading and running the MSI.

Well, that worked. But, where do I find the PSM1 or PS1 files? I did not see them pop into any module directory.

Support asynchronous install of MSI to allow cancelling of install.

It would be nice if the Install-MSI function could support a 3-part asynch model. The reason is, if i "stop" a powershell script execution while it is running an MSI, the MSI runs to completion (taking several minutes) and i would like it to cancel/rollback the MSI, it also gives me more control of when to start the MSI progress bar and potentially nest it under other progress bars.

Example cmdlets:

  1. Start-MSIInstall
    Starts the installer and returns a context object
  2. Watch-MSIInstall
    Monitors the installer using the context object and displays progress bars, etc
  3. Stop-MSIInstall
    Stops/cancels the install

Example desired code:

try {
   $MSIObject = Start-MSIInstall $InstallPath
   $MSIObject | Watch-MSIInstall -ParentProgressID $MyProgressID
} catch {
   #do some thing
} finally {
   #ensure MSI is not still running 
   if ($MSIObject.IsRunning) {
       $MSIObject | Stop-MSIInstall
   }
}

Installer/Artifacts

Hi Heath,

I noticed your AppVeyor build doesn't produce any artifacts. What is the recommended way to get the latest install of this project?

Thanks!
James

How do I install psmsi?

I used to have a small system SSD and therefore chose to install Visual Studio Professional 2015 on my G: drive. After upgrading to a much bigger SSD, I now wish to reinstall VS 2015 on my C: drive, but the installer refuses to allow me to move away from the original G: location, even after uninstalling every app with Visual Studio in its name.

I then found your blog post at https://blogs.msdn.microsoft.com/heaths/2015/07/14/how-to-install-visual-studio-to-another-directory-when-a-pre-release-is-installed/.

I have downloaded psmsi from GitHub (using the Clone or Download button) but have no idea how to install it on my Windows 10 computer. Some guidance would be much appreciated. Please note that I know absolutely nothing about GitHub.

Unable to load module in PowerShell v2

On computers that only have PowerShell v2 installed, or when running later versions of PowerShell using the -version 2.0 command line switch, importing this MSI module returns the error: Could not load file or assembly \Microsoft.Tools.WindowsInstaller.PowerShell.dll or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.

Because of the dependency on the installation of newer NET Frameworks, many businesses (including ours) still have computers where we cannot install the latest version of PowerShell. For the next few years (until Win7 and Server 2008 R2 go off of support - and maybe a little beyond that) we will still need to support PowerShell v2.

Will you please either update the documentation to properly reflect the minimum version of PowerShell that is supported by the module, or provide DLLs that will work correctly with PowerShell version 2.0.

Is it possible to provide basic functionality that was in version 2.2.x via DLLs compiled specifically for PowerShell v2, while the newer DLLs would be dynamically used with newer versions of PowerShell?

services

I can't get install-msiproduct to work for applications which create a service - e.g. our anti virus solution
It keeps complaining about insufficient permissions (yes I am admin).

I this not working in general or am I missing something?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.