salt icon indicating copy to clipboard operation
salt copied to clipboard

Simple method for adding selected Windows Registry Keys or WMI classes to Grains

Open mike-ainsworth opened this issue 13 years ago • 3 comments

A simple method for adding custom Windows Registry Keys to Grains so they can be used for targeting, reporting etc. Microsoft stores an incredible amount of configuration data directly in the registry.

Perhaps a section in the Minion conf that would allow you to specify list of named Registry Keys and the corresponding value name. Example for RDP Port:

RDP-PORT HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp PortNumber

The ability to query a WMI class in order to populate grains would provide comprehensive targeting support for Microsoft systems. Example, if I want to know which Microsoft "Server Roles" are installed such as "web server", "DNS Server", "SMTP Server" etc this is best retrieved remotely via WMI (see http://msdn.microsoft.com/en-us/library/cc280268(VS.85).aspx)

Example might look something like:

SERVER-ROLES "Select Name from ROOT\CIMV2\Win32_ServerFeature"

mike-ainsworth avatar Aug 10 '13 20:08 mike-ainsworth

Yes, harnessing the data in the registry will be very useful.

basepi avatar Aug 12 '13 17:08 basepi

BTW, Win32_ServerFeature is deprecated, and slated to be replaced by: MSFT_ServerManagerDeploymentTasks for Windows 8/2012 Server. Thanks, Microsoft!

Windows Powershell has cmd-lets for handling these, also, which is probably safer for now.

Geo23589 avatar Jan 11 '14 18:01 Geo23589

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.

stale[bot] avatar Nov 10 '17 19:11 stale[bot]