Solved

Powershell

Posted on 2014-01-13
6
422 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
Is Your AD Toolbox Looking More Like a Toybox?

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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

Suggested Solutions

As with any other System Center product, the installation for the Authoring Tool can be quite a pain sometimes. This article serves to help you avoid making these mistakes and hopefully save you a ton of time on troubleshooting :)  Step 1: Make sur…
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 look for a specific file type in a local or remote server directory using PHP.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

920 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now