locked
Running .exe remotely RRS feed

  • Question

  • Hi guys,

    I would like to create a line that permit the execution of an .exe file from another machine (the .exe file is in a network location)

    I tryed with this:

    invoke-command -computername computername.domain.com -filepath \\my\network\path\file.exe

    But seems that .exe file are not accepted.

    Can you help me?

    Thanks everyone


    Wednesday, June 22, 2016 1:52 PM

Answers

  • You cannot remotely run a remote exe.  The exe must reside on the remote system or you must reconfigure your network in ways that should not be used automatically.

    Most exe files cannot run remotely unattended.  You have to know that this possible first.


    \_(ツ)_/

    So can I create a .ps1 file that run an .exe file from a network directory?



    You can't if your network is not configure to allow this. Windows, by default, does not allow this.

    \_(ツ)_/

    • Proposed as answer by Hello_2018 Thursday, June 23, 2016 9:27 AM
    • Marked as answer by Hello_2018 Friday, July 1, 2016 2:30 AM
    Wednesday, June 22, 2016 3:53 PM

All replies

  • Apart from every other issues, ure very likely run into double-hop issue as well
    You should post errors u get

    Wednesday, June 22, 2016 2:11 PM
  • No double hop here as the file is an argument on local command.

    The issue is that most files cannot be executed this way.

    -FilePath wants a script.  Read the help.  It cannot be used to run an executable.

     


    \_(ツ)_/

    Wednesday, June 22, 2016 2:28 PM
  • No double hop here as the file is an argument on local command.

    The issue is that most files cannot be executed this way.

    -FilePath wants a script.  Read the help.  It cannot be used to run an executable.

     


    \_(ツ)_/

    Yes exactly. I receive the error that only .ps1 can be runned.

    What should I do ?

    Regards

    Wednesday, June 22, 2016 2:32 PM
  • You cannot remotely run a remote exe.  The exe must reside on the remote system or you must reconfigure your network in ways that should not be used automatically.

    Most exe files cannot run remotely unattended.  You have to know that this possible first.


    \_(ツ)_/

    Wednesday, June 22, 2016 2:51 PM
  • You cannot remotely run a remote exe.  The exe must reside on the remote system or you must reconfigure your network in ways that should not be used automatically.

    Most exe files cannot run remotely unattended.  You have to know that this possible first.


    \_(ツ)_/

    So can I create a .ps1 file that run an .exe file from a network directory?


    Wednesday, June 22, 2016 3:16 PM
  • You cannot remotely run a remote exe.  The exe must reside on the remote system or you must reconfigure your network in ways that should not be used automatically.

    Most exe files cannot run remotely unattended.  You have to know that this possible first.


    \_(ツ)_/

    So can I create a .ps1 file that run an .exe file from a network directory?



    You can't if your network is not configure to allow this. Windows, by default, does not allow this.

    \_(ツ)_/

    • Proposed as answer by Hello_2018 Thursday, June 23, 2016 9:27 AM
    • Marked as answer by Hello_2018 Friday, July 1, 2016 2:30 AM
    Wednesday, June 22, 2016 3:53 PM
  • Hi Mizter_E,

    >>I would like to create a line that permit the execution of an .exe file from another machine (the .exe file is in a network location)

    I suppose we could try this workaround.

    Copy-Item -Path \\server2012\share\*.exe -destination c:\share
    
    $item = Get-ChildItem -Filter *.exe
    
    Start-Process -FilePath $item

    Or, you could simply use: \\server2012\share\*.exe

    Trying to make things easy is also not a bad idea.

    Best regards,


    Andy_Pan

    • Edited by Hello_2018 Thursday, June 23, 2016 9:41 AM
    Thursday, June 23, 2016 9:36 AM
  • Hi Mizter_E,

    >>I would like to create a line that permit the execution of an .exe file from another machine (the .exe file is in a network location)

    I suppose we could try this workaround.

    Copy-Item -Path \\server2012\share\*.exe -destination c:\share
    
    $item = Get-ChildItem -Filter *.exe
    
    Start-Process -FilePath $item

    Or, you could simply use: \\server2012\share\*.exe

    Trying to make things easy is also not a bad idea.

    Best regards,


    Andy_Pan

    Hi Andy,

    thanks for you help.

    The problem is that I would like to run a .exe file from another machine :D I meant that the remote machine must run the script.. :D
    Regards

    Thursday, June 23, 2016 12:32 PM