How to programmatically change settings for WMI instead of using wmimgmt.msc snappin?

Usually you go as follows:

  • start โ†’ run
  • type wmimgmt.msc and press enter
  • riht click "Manage WMI" node -> Properties
  • on the security tab, click the security button
  • add new user
  • for the user you just added, enable "Remote enable"

How can this be done programmatically (C # or vbs)? I searched the Internet and found something to do using WMIC, but I donโ€™t understand how to do it. Here are the links if they help you. http://msdn.microsoft.com/en-us/library/aa393613%28v=vs.85%29.aspx
http://msdn.microsoft.com/en-us/library/aa393611%28v=vs.85%29.aspx
http://msdn.microsoft.com/en-us/library/aa822575%28v=vs.85%29.aspx
http://msdn.microsoft.com/en-us/library/aa822576%28v=vs.85%29.aspx
http://msdn.microsoft.com/en-us/library/aa394531%28v=VS.85%29.aspx

Thank you very much

+4
source share
2 answers

I wonโ€™t explain exactly how to do this, but since you are doing something related to a good understanding of windows, programming and administration, Iโ€™ll just give you a link to the source code that you can adapt to your project to manage WMI security :

http://www.codeproject.com/KB/system/WmiSecurity.aspx

Basically you should note the following paragraph:

So, at this stage, examples are enough to illustrate the use of the utility. Suppose you want to add the HelpDesk domain group to CIMV2 and the subsequent namespaces on computer S223001. Also, suppose this group must be able to remotely connect and read WMI objects. For this:

WmiSecurity / C = S223001 / A / N = Root \ CimV2 / M = MyDomain \ HelpDesk: REMOTEACCESS / R

Hope this can help.

Greetings.

+2
source
+1
source

Source: https://habr.com/ru/post/1346820/


All Articles