Solved

Powershell

Posted on 2014-01-13
6
427 Views
Last Modified: 2014-01-15
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?
0
Comment
Question by:WPincusIT
6 Comments
 
LVL 18

Expert Comment

by:Raheman M. Abdul
ID: 39777403
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
 
LVL 2

Expert Comment

by:slavs
ID: 39778684
Have you checked that the target machine allows remoting via Enable-PSRemoting?

To add to Rahemans idea, are you impersonating a user?
0
 
LVL 18

Expert Comment

by:Raheman M. Abdul
ID: 39778777
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
Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

 

Author Comment

by:WPincusIT
ID: 39780168
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
 
LVL 11

Accepted Solution

by:
marek1712 earned 500 total points
ID: 39782229
That means policy is probably defined by some GPO.
Run RSoP.msc to pin down the source.
0
 

Author Comment

by:WPincusIT
ID: 39782393
It was a GPO that had the execution policy set to only -Allsigned which was overriding the local setting
0

Featured Post

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I thought I'd write this up for anyone who has a request to create an anonymous whistle-blower-type submission form created using SharePoint 2010 (this would probably work the same for 2013). It's not 100% fool-proof but it's as close as you can get…
Create and license users in Office 365 in bulk based on a CSV file. A step-by-step guide with PowerShell script examples.
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question