troubleshooting Question

Powershell script runs locally but not remotely

Avatar of Jacob L
Jacob LFlag for United States of America asked on
Powershell
11 Comments1 Solution836 ViewsLast Modified:
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\copyfromFTP.ps1 }
Access is denied
    + CategoryInfo          : PermissionDenied: (\\wmvddaxapp10\..._2017-03-06.txt:String) [Move-Item], UnauthorizedAccessException
    + FullyQualifiedErrorId : MoveItemUnauthorizedAccessError,Microsoft.PowerShell.Commands.MoveItemCommand
    + PSComputerName        : wmvddaxapp10
 
Access is denied
    + CategoryInfo          : PermissionDenied: (\\wmvddaxapp10\...50_24248442.xml:String) [Move-Item], UnauthorizedAccessException
    + FullyQualifiedErrorId : MoveItemUnauthorizedAccessError,Microsoft.PowerShell.Commands.MoveItemCommand
    + PSComputerName        : wmvddaxapp10
 
Access is denied
    + CategoryInfo          : PermissionDenied: (\\wmvddaxapp10\...R_Receivers.txt:String) [Move-Item], UnauthorizedAccessException
    + FullyQualifiedErrorId : MoveItemUnauthorizedAccessError,Microsoft.PowerShell.Commands.MoveItemCommand
    + PSComputerName        : wmvddaxapp10
ASKER CERTIFIED SOLUTION
skullnobrains

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 11 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 11 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros