I have a powershell script that simply copies files from one server to multiple other servers. runs fine when i loggin to the server and run it. but does nothing when i try to execute it remotely through an application.
ive tried putting this at the beginning of the script.
powershell.exe Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy AllSigned -Force
also tried
Set-ExecutionPolicy -ExecutionPolicy Unrestricted
any help greatly appreciated.
Not sure if this helps but as i am troubleshooting i tried to invoke-command from a remote server and get following error.
PS C:\Windows\system32> Invoke-Command -ComputerName wmvddaxapp10 -ScriptBlock { D:\NCR\DAX\Scripts\copyfro
m
FTP.ps1 }
Access is denied
+ CategoryInfo : PermissionDenied: (\\wmvddaxapp10\..._2017-0
3-06.txt:S
tring) [Move-Item], UnauthorizedAccessExceptio
n
+ FullyQualifiedErrorId : MoveItemUnauthorizedAccess
Error,Micr
osoft.Powe
rShell.Com
mands.Move
ItemComman
d
+ PSComputerName : wmvddaxapp10
Access is denied
+ CategoryInfo : PermissionDenied: (\\wmvddaxapp10\...50_2424
8442.xml:S
tring) [Move-Item], UnauthorizedAccessExceptio
n
+ FullyQualifiedErrorId : MoveItemUnauthorizedAccess
Error,Micr
osoft.Powe
rShell.Com
mands.Move
ItemComman
d
+ PSComputerName : wmvddaxapp10
Access is denied
+ CategoryInfo : PermissionDenied: (\\wmvddaxapp10\...R_Recei
vers.txt:S
tring) [Move-Item], UnauthorizedAccessExceptio
n
+ FullyQualifiedErrorId : MoveItemUnauthorizedAccess
Error,Micr
osoft.Powe
rShell.Com
mands.Move
ItemComman
d
+ PSComputerName : wmvddaxapp10
i have no idea if invoke-command can set the network user but either that's in the help, or you can alternatively use psexec which does when you connect using "-u user". you can obviously use the currently logged on user.