Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I query Windows registry keys from Linux?

I am developing a Linux auditing application that, among other things, has to retrieve installed software and licenses from a Windows machine. The application MUST be agent-free. wmi-client actually does implement what I want, I tryed to query applications and it worked just fine:

# LAUNCHING WMIC PLUGIN 
my $cmd = "wmic -U ".$username."%".$password." //".$hostname." \"select Name, Version from Win32_Product\"";
my $output = `$cmd`;
print "INSTALLED SOFTWARE:\n";  
print "$output";

Now my question is, how can I retrieve the Product Key for certain applications? I know that sometimes they are stored in the Registry Key, can I query them through WMI?

EDIT: Just found that on a website:

http://social.technet.microsoft.com/Forums/en/winserverGP/thread/5cd1b80a-2f90-4d46-bf65-dba52dcf0c56

WQL queries are based on certain WMI classes which offer a set of properties. The WMI registry actions instead are based on the "StdRegProv" in the "Default" namespace and certain methods have to be called to get a result. That means a registry query bases WMI filter is not possible.

So it looks like WQL cannot interrogate Registry Keys, what can I do then? Any ideas?

like image 518
raz3r Avatar asked Dec 20 '25 07:12

raz3r


1 Answers

I do not have any experience using it on non-Windows clients, but there is DBD::WMI.

like image 110
Sinan Ünür Avatar answered Dec 22 '25 21:12

Sinan Ünür



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!