powershell remotely install msi failed when no user logged in

jackie chan 21 Reputation points
2022-11-29T03:18:39.3+00:00
Invoke-Command -ScriptBlock  {msiexec.exe /i C:\Users\printer_SPDF_pullprint20221122\setup.msi} -ComputerName MCSVDI049  
When i logged administrator,it will success at once  
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,448 questions
0 comments No comments
{count} votes

Accepted answer
  1. MotoX80 32,716 Reputation points
    2022-11-29T03:32:49.28+00:00

    Run "msiexec /?". That will show you the command line switches. Add logging such as "/l c:\Users\SPDF.log". Review the log with the software vendor.

    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Amit Singh 4,866 Reputation points
    2022-11-29T10:51:11.667+00:00

  2. Limitless Technology 44,096 Reputation points
    2022-11-30T14:35:38.8+00:00

    Hi,

    Thank you for posting your query.

    Kindly follow the steps provided below to resolve your issue.

    Solved with the aid of a reply on another forum - thanks mklement0

    Just wrap the Start-Process in brackets and add .ExitCode and it works fine e.g.

    $Result = Invoke-Command -computername MYREMOTEPC -ScriptBlock {(Start-Process "msiexec" -ArgumentList "/i C:\tmp\MYSOFTWARE.msi /quiet /norestart" -Wait -Passthru).ExitCode}

    Go to this link for your reference and other troubleshooting procedures https://learn.microsoft.com/answers/questions/227975/getting-msi-exit-code-when-installing-remotely-usi.html

    Do not hesitate to message us if you need further assistance.

    --------------------------------------------------------------------------------------------------------------------------------

    If the answer is helpful kindly click "Accept as Answer" and up vote it.