Skip to content

Can't start .msi from powershell core #4499

Closed

Description

@SteveL-MSFT

Invoke-Item on the MSI does work

Steps to reproduce

PS C:\Users\slee\repos\PowerShell> .\PowerShell-6.0.0-beta.5-win10-win2016-x64.msi

Expected behavior

MSI installer to start

Actual behavior

Cannot run a document in PowerShell Core: C:\Users\slee\repos\PowerShell\PowerShell-6.0.0-beta.5-win10-win2016-x64.msi.
At line:1 char:1
+ .\PowerShell-6.0.0-beta.5-win10-win2016-x64.msi
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (C:\Users\slee\r...win2016-x64.msi:String) [], RuntimeException
    + FullyQualifiedErrorId : CantActivateDocumentInPowerShellCore

Environment data

Name                           Value
----                           -----
PSVersion                      6.0.0-beta
PSEdition                      Core
GitCommitId                    v6.0.0-beta.5-8-g879b7da4ac327865570d3e696a744d49e8eb7c85-dirty
OS                             Microsoft Windows 10.0.16257
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Activity

  1. added
    WG-Engine
    on Aug 4, 2017
  2. added this to the milestone on Aug 4, 2017
  3. changed the title [-]Can start .msi from powershell core[/-] [+]Can't start .msi from powershell core[/+] on Aug 4, 2017
  4. daxian-dbw commented on Aug 4, 2017

    @daxian-dbw
    Member

    ProcessStartInfo.UseShellExecute is now supported in .NET Core. On windows, it works as expected (opening the default applications associated with the file extension). However, the behavior is not expected on Linux (and probably on Mac too).

    Example:

    [E:\PowerShell]
    PS:132> $s = [System.Diagnostics.ProcessStartInfo]::new()
    [E:\PowerShell]
    PS:133> $s.UseShellExecute = $true
    [E:\PowerShell]
    PS:134> $s.FileName = "F:\tmp\text-utf8.txt"
    [E:\PowerShell]
    PS:135> [System.Diagnostics.Process]::Start($s)
    
     NPM(K)    PM(M)      WS(M)     CPU(s)     Id  SI ProcessName
     ------    -----      -----     ------     --  -- -----------
         14     3.05      15.86       0.06 ...148   1 Notepad2
    
    
    [E:\PowerShell]
    PS:136> start F:\tmp\
    [E:\PowerShell]
    PS:137> $s.FileName = "F:\tmp\doc.docx"
    [E:\PowerShell]
    PS:138>
    [E:\PowerShell]
    PS:138> [System.Diagnostics.Process]::Start($s)
    
     NPM(K)    PM(M)      WS(M)     CPU(s)     Id  SI ProcessName
     ------    -----      -----     ------     --  -- -----------
         11     4.56      11.62       0.06 ...148   1 WINWORD
    
  5. daxian-dbw commented on Aug 4, 2017

    @daxian-dbw
    Member

    So we actually need to clean up our code about the ShellExecuteEx implementation ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Resolution-FixedWG-Engine

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions