Is it possible to call a powershell script from a sharepoint timer job ? or are there any security issues involved in doing so?
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It only takes a minute to sign up.Sign up to join this community
There are a couple of ways of calling PowerShell from within code (e.g. within a timer job):
You have to give some thought to where the timer job is running, if you have a farm with multiple servers. The timer job normally runs as the farm account. You will also need to load up the SharePoint snap-in.
I can't see much technical advantage in doing this as everything you can do in PowerShell can be achieved using the object model. However, you may already have script written, or you might want to use a PowerShell cmdlet that would need to be re-implemented programmatically. I don't think it is completely unreasonable to do this, depending on what you are trying to achieve.