VB.Net - Local WMI Connection with user credentials

社会主义新天地 提交于 2019-12-03 21:00:54

You don't have access to some wmi instances when a user without administrator privileges is currently logged in. (This is only applied to Local WMI connections)

MSDN reference on the topic

It's pretty lame! But if you can run your application as a user which is a member of administrators group, then you're problem should be solved.

Added note:

If you write a windows service with **local system** user, then you'll have full access to all wmi classes.


note: I've tried to grant my limited user the proper permissions to access desired wmi actions, but it seems it doesn't work that way. In this case, you'll have to set the permissions in these 3 places:

  1. Start->Run->dcmoncnfg->Component Services->Computers->My Computer->Properties->COM security tab
  2. Start->Run->dcmoncnfg->Component Services->Computers->My Computer->DCOM Config->Windows Management and Instrumention->Properties->Security tab
  3. Start->Run->wmimgmt.msc->WMI Control(Local)->Properties->Root(just highlight)->Security tab
Robert

I know this question is old, but I tried the above steps and it didn't work. What I found to work was this:

https://web.archive.org/web/20150213044821/http://www.manageengine.com/network-monitoring/help/troubleshoot_opmanager/troubleshoot_wmi.html

80041064 - User credentials cannot be used for local connections

Cause

This error is encountered when you specify the Username and password for monitoring the machine where OpManager is running.

Solution

Do not specify Username and password for the localhost. To resolve the issue, remove the configured user name and password from "Passwords" link in the device snapshot page.

enter the wmic prompt by typing wmic and then enter. Then type:

/user:""

This will null the user it's trying to run the commands as. You might have to do something similar with password, I dunno.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!