Start-Process with output to find success or failure RRS feed

  • Question

  • Hi,

    I am using this command to copy the file from remote server to my machine.

     Start-Process powershell.exe -ArgumentList  '-nologo -File c:\Share\1.ps1' -Credential $credential 

    there is a 1.ps file which I need to run with specific credential and find out whether ot ran successfully or not . If there is some error it should show that as well.

    Also I need to pass arguments to the 1.ps1 file how do we do it?

    How to do it?


    • Moved by Bill_Stewart Friday, July 27, 2018 7:54 PM Abandoned
    Monday, May 14, 2018 9:32 PM

All replies

  • Add "-PassThru" to the command. the returned object contains the status.

    help start-process -online


    Monday, May 14, 2018 10:46 PM