Solved

powershell Security question

Posted on 2013-10-29
4
552 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Very detailed, it worked perfectly

Thanks
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Why would I want to create a function for tracking messages? I am glad you asked. As with most monotonous/routine tasks, human error tends to creep in after doing the same task over and over again. By creating a function, you load the function once…
This article will help you understand what HashTables are and how to use them in PowerShell.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

762 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

10 Experts available now in Live!

Get 1:1 Help Now