Powershell

When I create and run a powershell script on my machine, it runs fine.  When I deploy the script using SCCM, the script fails.  I check a target machine and change the Powershell execution policy to unrestricted but it still fails.  What could be the problem?
WPincusITAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
marek1712Connect With a Mentor Commented:
That means policy is probably defined by some GPO.
Run RSoP.msc to pin down the source.
0
 
Raheman M. AbdulSenior Infrastructure Support Analyst & Systems DeveloperCommented:
Are you running the script under the user who have enough rights to access the resources you are using from it?
If you could post the error it will be easy for experts to comment please.
0
 
slavsCommented:
Have you checked that the target machine allows remoting via Enable-PSRemoting?

To add to Rahemans idea, are you impersonating a user?
0
NEW Internet Security Report Now Available!

WatchGuard’s Threat Lab is a group of dedicated threat researchers committed to helping you stay ahead of the bad guys by providing in-depth analysis of the top security threats to your network.  Check out this quarters report on the threats that shook the industry in Q4 2017.

 
Raheman M. AbdulSenior Infrastructure Support Analyst & Systems DeveloperCommented:
compare the versions of powershell on both machines. (some cmdlets wont run on lower version)
As suggested by slavs, run "Enable-psremoting" cmdlet on the the target machine and see if it works.
what happens when you copy the script to target machine and run from locally
0
 
WPincusITAuthor Commented:
When I run the script on the target machine locally as  local administrator, it does not run as well.  When I change the execution policy to unrestricted I get an error "Windows Powershell updated your execution policy successfully, but the setting is overridden by a policy defined at a more specific scope"
0
 
WPincusITAuthor Commented:
It was a GPO that had the execution policy set to only -Allsigned which was overriding the local setting
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.