.NET Questions and Solutions

As a software engineer, I focus on .NET, especially asp.net, C#, WCF and so on, and I am also very interested in Search Engine Optimization.

Entries Tagged ‘powershell’

Error message when you use a startup script to start the SQL Server PowerShell provider in SQL Server 2008: “Set-Location: Object reference not set to an instance of an object”

Symptoms
Microsoft SQL Server 2008 installs the SQL Server PowerShell (SQLPS) provider as a feature. When you use a startup script to start the SQL Server PowerShell provider separately without using the SQLPS minishell, the SQL Server PowerShell provider does not let you navigate the SQL Server object hierarchy. Instead, you receive the following exception error message:

Set-Location: Object reference not set to an instance of an object.
Resolution
The SQL Server PowerShell provider requires certain global variables to exist. Typically, the SQLPS minishell sets these global variables. However, when you use a startup script to start the SQL Server PowerShell provider, these global variables are not declared.

An exception error is generated after you run a Set-AttachmentfilterListConfig command together with the ExceptionConnectors option on an Exchange 2007 SP1-based server

Symptoms
When you run the Set-AttachmentfilterListConfig command together with the -ExceptionConnectors option on an Exchange Server 2007-based server, the command doesnot run successfully. Additionally, an exception is generated.
For example, you may run the following command:
Set-AttachmentfilterListConfig -ExceptionConnectors d18f518a-38e3-4349-9697-bc2ac318461f When you run this command, you receive the following error message:

WARNING: An unexpected error has occurred and debug information is being generated: Unable to cast object of type ‘System.Collections.Generic.List`1[Microsoft.Exchange.Data.Directory.SystemConfiguration.ReceiveConnector]‘ to type ‘Microsoft.Exchange.Data.Directory.SystemConfiguration.ReceiveConnector[]‘. Set-AttachmentfilterListConfig : Unable to cast object of type ‘System.Collections.Generic.List`1[Microsoft.Exchange.Data.Directory.SystemConfiguration.ReceiveConnector]‘ to type ‘Microsoft.Exchange.Data.Directory.SystemConfiguration.ReceiveConnector[]‘. At line:1 char:31 + Set-AttachmentfilterListConfig? <<<< -ExceptionConnectors d18f518a-38e3-4349-9697-bc2ac318461f Additionally, the follow event is logged in the Application log:
Event Type:?Error
Event Source:?MSExchange Common
Event Category:?General
Event ID:?4999
User:??N/A
Computer:?Servername
Description: Watson report about to be sent to dw20.exe for process id: <ID>, with parameters: E12, c-RTL-x86, <version>, powershell, M.E.Management, M.E.M.M.A.SetAttachmentFilterListConfig.InternalProcessRecord, System.InvalidCastException, 4e90, <version>.? ErrorReportingEnabled: False For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
Resolution
To resolve this problem, install Update Rollup 2 for Exchange Server 2007 Service Pack 1. For more information about Update Rollup 2 for Exchange Server 2007 Service Pack 1, see the following Exchange Help topic:
Description of Update Rollup 2 for Exchange Server 2007 Service Pack 1 (http://go.microsoft.com/fwlink/?LinkId=152558)For more information about how to install the latest Exchange service pack or update rollup, see the following Exchange Help topic:
How to Obtain the Latest Service Pack or Update Rollup for Exchange 2007(http://go.microsoft.com/fwlink/?LinkId=152570)