Error message when you run Get-Command in a PowerShell version 2 environment on a server that is running SQL Server 2008 or SQL Server 2008 R2: "Object reference not set to an instance of an object"

Article translations Article translations
Article ID: 2216478 - View products that this article applies to.
Expand all | Collapse all

On This Page

SYMPTOMS

Consider the following scenario:
  • You have Windows PowerShell version 2 installed on a computer that is running Microsoft SQL Server 2008 or Microsoft SQL Server 2008 R2.
  • You run the sqlps utility to start the PowerShell environment.
  • At the command prompt, you run the Get-Command command to retrieve a list of available commands.

In this scenario, you receive the following error message:
Get-Command : Object reference not set to an instance of an object.
At line:1 char:12
+ get-command <<<<
+ CategoryInfo : NotSpecified: (:) [Get-Command], NullReferenceException
+ FullyQualifiedErrorId : System.NullReferenceException,Microsoft.PowerShell.Commands.GetCommandCommand

RESOLUTION

Service pack information for SQL Server 2008

To resolve this problem, obtain the latest service pack for SQL Server 2008. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
968382 How to obtain the latest service pack for SQL Server 2008

Service pack information for SQL Server 2008 R2

To resolve this problem, obtain the latest service pack for SQL Server 2008 R2. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
2527041 How to obtain the latest service pack for SQL Server 2008 R2

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

This problem was first corrected in Microsoft SQL Server 2008 Service Pack 2.
This problem was first corrected in SQL Server 2008 R2 Service Pack 1.

MORE INFORMATION

For more information about the sqlps utility, see the following topic on the Microsoft TechNet website:
sqlps Utility

Properties

Article ID: 2216478 - Last Review: April 22, 2011 - Revision: 3.0
APPLIES TO
  • Microsoft SQL Server 2008 Enterprise
  • Microsoft SQL Server 2008 Developer
  • Microsoft SQL Server 2008 Standard
  • Microsoft SQL Server 2008 R2 Developer
  • Microsoft SQL Server 2008 R2 Enterprise
  • Microsoft SQL Server 2008 R2 Standard
Keywords: 
kbinfo kbexpertiseinter kbprb kbbug kbtshoot kbsurveynew KB2216478

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com