Execute powershell script via Process Task Editor
In my Execute Process Task I am executing a bat file calling my powershell script; however, when I execute the task I get the "cannot be loaded becasue the execution of scripts is disabled...."
My bat file looks like this: powershell -noexit z:\linebarger\logs\movelogs.ps1
How do I get the set-execution parameter in there so I can run the .ps1?
July 15th, 2011 9:33am
It is a security policy setting for PS on the machine (I guess), you need to prepare the machine for PowerShell runs. See this article: http://technet.microsoft.com/en-us/library/ee176949.aspx
On a test machine I usually type in PS shell:
Set-ExecutionPolicy unrestricted
To allow scripts
Arthur My Blog
Free Windows Admin Tool Kit Click here and download it now
July 15th, 2011 9:46am
It is a security policy setting for PS on the machine (I guess), you need to prepare the machine for PowerShell runs. See this article: http://technet.microsoft.com/en-us/library/ee176949.aspx
On a test machine I usually type in PS shell:
Set-ExecutionPolicy unrestricted
To allow scripts
Arthur My Blog
I think that is only for each PS session.
July 15th, 2011 10:46am
It is a security policy setting for PS on the machine (I guess), you need to prepare the machine for PowerShell runs. See this article: http://technet.microsoft.com/en-us/library/ee176949.aspx
On a test machine I usually type in PS shell:
Set-ExecutionPolicy unrestricted
To allow scripts
Arthur My Blog
I think that is only for each PS session.
My understanding is that the policy remains in place for subsequent sessions too. I wouldn't guarantee it though - I'm no Powershell expert.
I'm pretty sure, however, that you can set session-specific parameters via the Powershell profile file (http://msdn.microsoft.com/en-us/library/bb613488%28v=vs.85%29.aspx).http://sqlblog.com/blogs/jamie_thomson/ |
@jamiet |
About me
Free Windows Admin Tool Kit Click here and download it now
July 15th, 2011 10:49am
It is a not per session setting. it is global.
Let me add the default option is LocalMachine, so like I said, the above setting allows to run all scripts to any user. I do not advocate doing this in prod and exercise caution even in dev.
Arthur My Blog
July 15th, 2011 10:55am
It is a not per session setting. it is global.
Let me add the default option is LocalMachine, so like I said, the above setting allows to run all scripts to any user. I do not advocate doing this in prod and exercise caution even in dev.
Arthur My Blog
hmmmm, not working for me.
Free Windows Admin Tool Kit Click here and download it now
July 15th, 2011 1:14pm
You were correct, I was in the wrong PS session
July 15th, 2011 1:43pm


