Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a server running Windows Server 2008 (not R2) and SQL Server 2008. I installed Powershell 2 and it works fine when running Powershell scripts. However when trying to run a Powershell script in a SQL Job it appears to run using Powershell v1 as it returns the following:

A job step received an error at line 1 in a PowerShell script. The corresponding line is 'Import-Module Pscx'. Correct the script and reschedule the job. The error information returned by PowerShell is: 'The term 'Import-Module' is not recognized as the name of a cmdlet, function, script file, or operable program

How can I get it to run my scripts with Powershell v2?

share|improve this question
Looks like there were some PS enhancements in SQL 2008 SP 2. Are you running that yet? Perhaps this article will help also -!A034D6A0DDC4E64E!821.entry – Christopher Oct 14 '10 at 20:24
That does seem to explain the improvements though I have since ended up getting my job to run powershell and call my script rather than have the script itself in the job which seems to work fine, thanks anyway though. – Chao Oct 15 '10 at 14:48
up vote 1 down vote accepted

This is a limitation of the sqlps minishell in SQL Server 2008 and SQL Server 2008 R2. Importing modules or adding snappins are not supported in a a minishell. If you're interested in a detailed overview of the SQL Server minishell implementation see this blog post:

share|improve this answer
A bit of an old one, but relevant if anyone else comes across it – Chao Dec 30 '11 at 15:20

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.