Installing an MSP works on the local machine, fails remotely. Why?

Welcome Forums General PowerShell Q&A Installing an MSP works on the local machine, fails remotely. Why?

This topic contains 4 replies, has 2 voices, and was last updated by

5 years, 9 months ago.

  • Author
  • #4801

    Points: 0
    Rank: Member

    Good afternoon,

    I need some advice.

    I need to install an application's MSP update file on multiple Win08r2 servers.  If I run these commands locally, within the target machine's PS window, it does exactly what I want it to:

    $command = 'msiexec.exe /p "c:\test\My Application Update 01.msp" REBOOTPROMPT=S /qb!'
    invoke-wmimethod -path win32_process -name create -argumentlist $command

    The file being executed is located on the target machine

    If I remotely connect to the machine, and execute the two commands, it opens two x64 msiexec.exe process, and one msiexec.exe *32 process, and just sits there.

    If I restart the server, it doesn't show that the update was installed, so I don't think it's a timing thing.

    I've tried creating and remotely executing a PS1 file with the two lines, but that seems to do the same thing.

    If anyone has advice on getting my MSP update installed remotely, I'd be all ears.

    I think I've included all the information I have, but if something is missing, please ask questions, and I'll fill in any blanks.

    Thank you in advance for your time and assistance!


  • #4809

    Points: 1,811
    Helping HandTeam Member
    Rank: Community Hero

    It might be (a) an interaction thing, meaning there's a process waiting for a desktop session or user interaction, or (b) a permissions issue. Curious: have you tried running this as a scheduled task, rather than via remoting? That would help rule out some possibilities. And – I'm only assuming you're using remoting; you didn't mention how you're connecting.

  • #4868

    Points: 0
    Rank: Member


    Thank you for your reply!  Unfortunately I'm not sure a scheduled task would work here.

    My process for this is:

    • Read a CSV for server name and Administrator password
    • Create a credential with the password
    • Create a new session using the machine name and credential
    • Create a temporary folder to hold my update MSP file
    • Call a PS1 file that downloads the update file to the target server
      • Creates a new System.Net.WebClient object
      • uses that web client object to download from the source to the location on the target server
    • Call another PS1 file that applies the patch that was just downloaded  –>> This is where I'm having issues.
      • Set the variable shown above
      • Execute the file specified in the variable
    • Close the session to the target server
    • Move to the next server in the CSV...

    If I open a PS window and manually set the variable, then execute it (as shown above in the two lines of code), it works fine.  If I create a PS1 file on the target server containing the same two lines, then right click > 'Run With PowerShell' a , it blinks the PowerShell window, and does nothing.  If I remotely execute my code in PowerGUI, it returns a block of text that looks like this, then just sits there.  RDP'd into the server, the installer never launches.  My understanding of the "Return Value" value is that "0" means the command was successful.

    PSComputerName     : xx.xx.xx.xx
    RunspaceId         : bf6f4a39-2338-4996-b75b-bjf5ef01ecaa
    PSShowComputerName : True
    __GENUS            : 2
    __CLASS            : __PARAMETERS
    __SUPERCLASS       :
    __DYNASTY          : __PARAMETERS
    __RELPATH          :
    __PROPERTY_COUNT   : 2
    __DERIVATION       : {}
    __SERVER           :
    __NAMESPACE        :
    __PATH             :
    ProcessId          : 4808
    ReturnValue        : 0

    I even added a line of code between the variable and the execution that creates a text file on the desktop, just to verify I was getting into my 'executeFile' file, and that text file does get created.  It seems that it's just not executing my MSP.

    Thank you in advance for your assistance!



  • #4893

    Points: 0
    Rank: Member


    If I create a PS1 file on the target server, containing the same two lines of code, then right click > ‘Run With PowerShell’ it works as expected / desired.


  • #5002

    Points: 1,811
    Helping HandTeam Member
    Rank: Community Hero

    You've tried a lot of things and I'm not sure I have a good grasp on them all :). I know little about PowerGUI, so I'm going to pas son that one.

    So you're saying this doesn't work even if you use Remote Desktop to go into the server and launch the installer? If that's the case, you may have something that has a dependency on the console session, and you're not going to be able to duplicate that remotely.

The topic ‘Installing an MSP works on the local machine, fails remotely. Why?’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort