invoke-command to run .exe install [resolved]

This topic contains 0 replies, has 1 voice, and was last updated by  Laurent Maene 1 year, 1 month ago.

  • Author
  • #66357

    Laurent Maene

    Hello, this is my first post to the community! PowerShell is awesome!
    When I was typing this post , I was still testing for a solution and I found it. So I decided to share it.

    ==> original post

    Any idea why this code doesn't work?

    Copy-Item \\$server\msi$\SAP_Outlook_Add-In.exe -Destination \\$computer\c$\temp
    Invoke-Command -ComputerName $computer -ScriptBlock {set-location c:\temp ; .\SAP_Outlook_Add-In.exe /q}

    By the way, this is working.

    Enter-PSSession -ComputerName $computer
    set-location c:\temp
    .\SAP_Outlook_Add-In.exe /q

    ==> solution

    So I mixed it to this and it is working.

    $s = New-PSSession -ComputerName $computer
    Invoke-Command -Session $s -ScriptBlock {set-location c:\temp ; .\SAP_SOD_Outlook_Add-In.exe /q}

The topic ‘invoke-command to run .exe install [resolved]’ is closed to new replies.