Tuesday, November 25, 2014

How to overcome error while importing the SQLPS module into Powershell?

In the previous post you learnt how to use SQL Server PowerShell Provider using the SQLPS.exe on your computer.

You could also run the SQL Server PowerShell Provider by importing the SQLPS module into PowerShell. It may produce the following error as shown:
--------------------
PS C:\Windows\system32> Import-Module “sqlps” -DisableNameChecking

WARNING: Could not obtain SQL Server Service information. An attempt to connect to WMI on 'Microsoft.WindowsAzure.Commands.SqlDatabase.Types.ps1xml' fa

iled with the following error: The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)

WARNING: Could not obtain SQL Server Service information. An attempt to connect to WMI on 'Microsoft.WindowsAzure.Commands.SqlDatabase.Types.ps1xml' fa

iled with the following error: The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)

WARNING: Could not obtain SQL Server Service information. An attempt to connect to WMI on 'Microsoft.WindowsAzure.Commands.SqlDatabase.Types.ps1xml' fa

iled with the following error: The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)

WARNING: Could not obtain SQL Server Service information. An attempt to connect to WMI on 'Microsoft.WindowsAzure.Commands.SqlDatabase.Types.ps1xml' fa

iled with the following error: The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)

WARNING: Could not obtain SQL Server Service information. An attempt to connect to WMI on 'Microsoft.WindowsAzure.Commands.SqlDatabase.Types.ps1xml' fa

iled with the following error: The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)

WARNING: Could not obtain SQL Server Service information. An attempt to connect to WMI on 'Microsoft.WindowsAzure.Commands.SqlDatabase.dll' failed with

the following error: The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)

WARNING: Could not obtain SQL Server Service information. An attempt to connect to WMI on 'Microsoft.WindowsAzure.Commands.SqlDatabase.dll' failed with

the following error: The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)

WARNING: Could not obtain SQL Server Service information. An attempt to connect to WMI on 'Microsoft.WindowsAzure.Commands.SqlDatabase.dll' failed with

the following error: The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)

WARNING: Could not obtain SQL Server Service information. An attempt to connect to WMI on 'Microsoft.WindowsAzure.Commands.SqlDatabase.dll' failed with

the following error: The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)

WARNING: Could not obtain SQL Server Service information. An attempt to connect to WMI on 'Microsoft.WindowsAzure.Commands.SqlDatabase.dll' failed with

the following error: The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)
 
Now how do you overcome this error.

The error is telling that the RPC server is unavailable. However you would notice that this service is started automatically on your machine and in fact there is no Start/Stop for this service.

 
 
However you notice that the RPCLocator service is manual and it can be started and stopped. Start this service as shown.
 

 
Now Import the module again from PowerShell prompt as shown in the next listing:
 
PS SQLSERVER:\> Import-Module “sqlps” -DisableNameChecking
PS SQLSERVER:\>

As you can see the exception is not raised.
Now you can happily look at the SQL Server as shown:
 
PS SQLSERVER:\> cd SQL
PS SQLSERVER:\SQL> dir

MachineName
-----------
HODENTEK8

PS SQLSERVER:\SQL> cd LocalHost
PS SQLSERVER:\SQL\LocalHost> dir
Instance Name
-------------
REGENCYPARK

1 comment:

  1. There is a connect item logged about this issue now, and I've included the causes of the warnings.
    https://connect.microsoft.com/SQLServer/feedback/details/1420992/import-module-sqlps-may-take-longer-to-load-but-always-returns-warnings-when-the-azure-powershell-module-is-also-installed

    ReplyDelete

Do you know what you installed while custom installing SQL Server 2022?

 When you install any software in Windows OS, the key information gets into the Registry and some of which you can look up in the control pa...