Solved

powershell Security question

Posted on 2013-10-29
4
562 Views
Last Modified: 2013-10-29
I have added a post backup event in Cobian to execute a powershell script.  It is to add event to the event log indicating the backup job has completed

I get the following message:

File C:\Powershell\addCobian.ps1 cannot be loaded because running scripts is disabled on this system.

I run scripts on this machine all of the time with no problem and this script will run to completion when run on its own.  Anybody have any idea what the problem is?

Thanks for the help
0
Comment
Question by:c7c4c7
4 Comments
 
LVL 7

Expert Comment

by:SterlingMcClung
ID: 39609493
It likely has to do with the user environment in which the script is being executed.  Does Cobian give the option to choose which user account is used to run the script?  If not, it is likely running the script under the same user that the cobian service is running.  Are you able to run that script yourself?
0
 
LVL 39

Expert Comment

by:footech
ID: 39609566
There are different scopes under which the execution policy can be set.  Run Get-ExecutionPolicy -list to see all the settings.  See
http://technet.microsoft.com/en-us/library/hh849821.aspx
for a description of what the different scopes will affect.  Perhaps you have it set so that you're not running under restrictions when using your account, but the backup job is using something different.
0
 
LVL 68

Accepted Solution

by:
Qlemo earned 500 total points
ID: 39610358
In detail, you might have to issue
Set-ExecutionPolicy RemoteSigned -Scope LocalMachine

Open in new window

once to set the policy for the executing machine. You can also call PS itself with a temporary change to the execution policy in Cobian:
PowerShell -ExecutionPolicy Unrestricted -File C:\Powershell\addCobian.ps1

Open in new window

0
 

Author Closing Comment

by:c7c4c7
ID: 39610817
Very detailed, it worked perfectly

Thanks
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

In this previous article (https://oddytee.wordpress.com/2016/05/05/provision-new-office-365-user-and-mailbox-from-exchange-hybrid-via-powershell/), we made basic license assignments to users in O365. When I say basic, the method is the simplest way …
A brief introduction to what I consider to be the best editor for PowerShell.
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

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

19 Experts available now in Live!

Get 1:1 Help Now