Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Connection failed to WMI service. Error: Permission denied

giriprasad9
Tera Expert

Hi,

I tried to discover a windows device and getting the error message "Connection failed to WMI service. Error: Permission denied".

I am getting the data from device when I run the below command in   MID server host's command prompt.

                  wmic /node: <IP>   /user:<user> /password:<password> path win32_operatingsystem


Anyone can let me know how can I resolve this issue.


- Giri

4 REPLIES 4

mamann
Mega Guru

Ensure that you have the mid.use_powershell parameter enabled for the MID Server record (this should be on by default in Fuji)



Here is a good explanation from Glenn Pinto @SN


This is a key error message ""Connection failed to WMI service. Error: Permission denied" This error message signifies that the Windows service credential is being used and is failing. If this is the only authentication error message being received, then the culprit is usually that PowerShell is not enabled correctly as you found out. If PowerShell is not enabled correctly then any Windows credentials defined in the SN Credentials table are not being used and only the MID Service Credential is.


In Fuji, this parameter is turned on by default on the MID Servers (thanks development), however PowerShell 2.0 must also be installed on each Windows Server MID or must be verified that it is installed.




This was taken from Re: Advanced Discovery Troubleshooting - WMI


Hi Mark,



After adding proprty "mid.use_powershell " I am able to discover the Windows servers.



Thanks for your support.


glennpinto
Kilo Guru

If you receive just this error message (Connection failed to WMI service. Error: Permission denied), it is basically letting you know that the Service Credential on the MID is failing. If that is the only credential being tried, it is a good indicator that PowerShell is not enabled correctly and as a result none of the Windows credentials defined in SN are being tried. Depending on version of SN being deployed, you have to do different things to enable PowerShell correctly.



Dublin and prior: you have to verify PowerShell 2.0 is enabled on the MID Server itself, unblock the set of PowerShell files on the MID Server as defined in the wiki, and set the mid.use_powershell property to true



Eureka: you have to do all the above but it is no longer required to unblock the PowerShell files



Fuji: they simplified the process further as the mid.use_powershell property is set to true by default now. All you have to do is verify that the MID has PowerShell 2.0 enabled.



The error message returned when the Service Credential on the MID is being tried and is incorrect is:


Connection failed to WMI service. Error: Permission denied



The error message returned when the Windows Credential entered in ServiceNow is tried and is incorrect is (PowerShell must be enabled correctly to use):


Failed to access target system. Please check credentials and firewall settings on the target system to ensure accessibility: Access is denied



Note the verbiage of the error messages do change slightly from release to release. So if you had PowerShell enabled correctly and both the Service and Windows Credential defined in SN failed, you should receive two error message that resemble the above.



It is important to note, that the targets do not need to have PowerShell enabled, just the MID Server. This is often misunderstood.



Hope this helps.


Hi Glenn,


I am receiving the below error message while trying to discover from one of my newly configured midserver,


"Connection failed to WMI service. Error: Permission Denied"



FYI :   I am using the same logon credentials in old midserver and getting discovered properly.



As you mentioned in above response, if this error message is related to the mid server logon credentials then, I should receive this error for both old and new mid server right?



kindly share your knowledge to resolve this issue.



Thanks in Advance!


Regards,


Narendran