running a PS script with psexec remotely

Welcome Forums General PowerShell Q&A running a PS script with psexec remotely

This topic contains 0 replies, has 1 voice, and was last updated by  Forums Archives 7 years, 2 months ago.

  • Author
  • #5861

    Points: 0
    Rank: Member

    by willbs at 2013-04-29 11:46:21

    i'm trying to run a powershell script remotely with psexec using this command

    psexec -i -s -d \\$global:uutName -u msunet2k\$global:PSexecUserName -p $global:password powershell_ise.exe "C:\serverfolders\users\pooltest.ps1"

    powershell starts, loads the script but does not execute it

    how do i get it to execute?


    by ArtB0514 at 2013-04-29 12:08:50

    Does the same thing happen when you use powershell.exe instead of the ISE?

    by willbs at 2013-04-29 12:46:10

    it starts but i get an error from the running the script

    if i run the script with powershell_ise manually it works fine

    by colt.45 at 2013-04-29 13:50:59

    What is the executionpolicy set as on the machine you are trying to execute the script on?

    by willbs at 2013-04-29 14:26:54

    set-executionpolicy -scope CurrentUser -executionPolicy Unrestricted -force

    by willbs at 2013-04-30 14:03:10

    what i ended up doing is running this command, and it worked fine, i didn't need to use psexec

    # create a storage pool with 2 drives
    invoke-command -scriptblock {
    Invoke-Expression -command C:\serverfolders\users\CreatePool.ps1
    } -computername $global:uutName -credential $global:Credential

The topic ‘running a PS script with psexec remotely’ is closed to new replies.

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