PsExec with PowerShell

This topic contains 1 reply, has 2 voices, and was last updated by Profile photo of Flynn Bundy Flynn Bundy 10 months, 3 weeks ago.

  • Author
    Posts
  • #34116
    Profile photo of Windows LiveUser138
    Windows LiveUser138
    Participant

    Hi together!

    I hope, someone encountered an equal or similar problem like myself and has some hints.
    I use PSExec (with domain admin credentials) for connecting to 1 to n machines at the same time, then transfering executable content to the remote station via share. Can be whole programs or batches or powershell scripts.

    Everything is working fine except one thing:
    If I execute a powershell script that is initiating a download sequence via system.net.webclient class the process is hanging if the domain admin is not really authenticated in an interactive session.

    If the domain admin is authenticated in a real interactive session I can see that the execution of the script is fully succesful. If not, the behaviour is identical but neither 'DownloadString' nor 'DownloadFile' is running properly.
    Before execution of a PowerShell script I ensure via registry setting that the execution policy is set to unrestricted.

    Has anyone an idea?

    Greets Robert

  • #34133
    Profile photo of Flynn Bundy
    Flynn Bundy
    Participant

    Hi Robert,

    If you could post your code we can happily help you out. There is not one reason I can imagine needing to use PSExec this day and age. You will really want to take a look into invoke-command for your remote parallel execution of a file. As for transferring files to different nodes you can use New-PSSdrive to open a drive to whichever location you like. From there Copy-item will help you pass those files to the endpoint.

You must be logged in to reply to this topic.