powershell WMI error: "Could not obtain SQL Server Service information. An attempt to connect to WMI ... failed with the following error: access is denied."

  • I get the following error when I launch powershell from SSMS, after right-clicking on a remote SQL instance and choosing "Start powershell":

    Warning: Could not obtain SQL Server Service information. An attempt to connect to WMI on server1 failed with the following error: access is denied.

    How can I fix this?

    __________________________________________________________________________________
    SQL Server 2016 Columnstore Index Enhancements - System Views for Disk-Based Tables[/url]
    Persisting SQL Server Index-Usage Statistics with MERGE[/url]
    Turbocharge Your Database Maintenance With Service Broker: Part 2[/url]

  • What version is the OS is running on the remote server? What version is the database instance?

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

  • opc.three (6/20/2011)


    What version is the OS is running on the remote server? What version is the database instance?

    Thank you for responding.

    OS is on Windows 2003 R2, SP2

    sql is on SQL 2008 SP2.

    __________________________________________________________________________________
    SQL Server 2016 Columnstore Index Enhancements - System Views for Disk-Based Tables[/url]
    Persisting SQL Server Index-Usage Statistics with MERGE[/url]
    Turbocharge Your Database Maintenance With Service Broker: Part 2[/url]

  • Please have a look at this MSDN forum post. It references an MSDN article related to SSIS but see the section "Eliminating the "Access Is Denied" Error. The original poster resolved his own issue referencing that article so DCOM settings may be a common root cause to both your issue and the SSIS issue referenced in the article:

    http://social.msdn.microsoft.com/Forums/en-NZ/sqltools/thread/7431a5a3-ef26-4e61-8a53-64cd616dcf84

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

  • opc.three (6/21/2011)


    Please have a look at this MSDN forum post. It references an MSDN article related to SSIS but see the section "Eliminating the "Access Is Denied" Error. The original poster resolved his own issue referencing that article so DCOM settings may be a common root cause to both your issue and the SSIS issue referenced in the article:

    http://social.msdn.microsoft.com/Forums/en-NZ/sqltools/thread/7431a5a3-ef26-4e61-8a53-64cd616dcf84

    Thank you, I'll check it.

    __________________________________________________________________________________
    SQL Server 2016 Columnstore Index Enhancements - System Views for Disk-Based Tables[/url]
    Persisting SQL Server Index-Usage Statistics with MERGE[/url]
    Turbocharge Your Database Maintenance With Service Broker: Part 2[/url]

  • You're welcome. If you happen to resolve it and have a moment to post the solution for others that would be great.

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

  • For sure.

    __________________________________________________________________________________
    SQL Server 2016 Columnstore Index Enhancements - System Views for Disk-Based Tables[/url]
    Persisting SQL Server Index-Usage Statistics with MERGE[/url]
    Turbocharge Your Database Maintenance With Service Broker: Part 2[/url]

  • Has anyone found a solid fix for this issue? The fix referenced in my MSDN post did not fully resolve the issue for me.

  • Firewall, RPC/DCOM setting/WMI securtiy might be involved.

    The following article might provide some info:

    http://sqlbeyond.blogspot.com/2010/05/sql-wmi-permission-issue.html

  • I had the same issue and fixed it.

    My problem was when launching Configuration Manager I got an error message in relation to WMI which actually caused the problem you saw in powershell. After I ran:

    mofcomp "C:\Program Files (x86)\Microsoft SQL Server\100\Shared\sqlmgmproviderxpsp2up.mof"

    Both issues were fixed. I am running sql2008 r2 on win 2008 r2. You might need to change the path above.

    By the way, why I found out this was because I tried to connect to a different instance on a different server, I didn't get the error. And that reminded me checking Configuration Manager because I had this issue before.

    Let me know if this is also the case for you.

  • Open Powershell IDE "As Administrator", worked for me !

  • The code I'm running on my SQL Central Management server is:

    $logs = 0..6 | % { (get-item SQLSERVER:\sql\<servername>\default).ReadErrorLog($_) }

    Originally, I got this to work by adding the service account that ran the PowerShell code to the local Administrators Windows group _AND_ creating a SQL login with sysadmin privileges on the remote SQL server host. Not sursprisingly, my security officer had an issue with this. My initial attempts to reduce access resulted i the following error:

    WARNING: Could not obtain SQL Server Service information. An attempt to connect

    to WMI on 'NEX-SRV1' failed with the following error: SQL Server WMI provider

    is not available on NEX-SRV1. --> Invalid namespace

    After quite a bit of fooling around, I have what I think is the minimum security needed to read the SQL error logs. Perform the following grants on the remote server running the SQL Server database:

    Local Windows Group

    - Add the service account to the "Distributed COM Users" group

    WMIMgmt.msc

    Add the service account to each of the following branches with all security options EXCEPT "Edit Security"

    - Root > cimv2

    - Root > cimv2 > ms_409

    - Root > Microsoft > SQLServer > ComputerManagement

    SQL Server

    - Create a SQL login for the service account and add it to the "Security Admin" role.

    After I had made these changes, I have the ability to monitor SQL Error logs from a central location without having to grant crazy levels of access to the service account.

Viewing 12 posts - 1 through 11 (of 11 total)

You must be logged in to reply to this topic. Login to reply