Author Posts

January 1, 2012 at 12:00 am

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