WmiInspector plug-in: Difference between revisions
No edit summary |
|||
(10 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{PageAuthor|L0k1}} | |||
== Links == | == Links == | ||
Download:<br> | Download:<br> | ||
<attach>WmiInspector.zip</attach> | |||
[http://forums.winamp.com/showthread.php?s=&threadid=291072 Forum thread] | |||
== Description == | == Description == | ||
This plugin sends request to the system using MS WMI API and returns the value on the stack. | |||
Plugin first returns "OK" if successfull, "error" if failed then the requested value or the error description. | |||
''Rem: An empty string might be returned as a result for the requested value. This doesn't mean that an error occurs but that there's not information for this value. See Antivirus exemple.'' | |||
== Command line == | == Command line == | ||
Plug-in DLL functions (entry points): | Plug-in DLL functions (entry points): Request, OS, OSVersion, FullOS, AntiVirus, FireWall, CPU, Resolution, SQLVersion, FullSQLVersion | ||
=== Request DLL Function === | |||
<highlight-nsis> | |||
WmiInspector::Request DomainName TableName ValueName | |||
</highlight-nsis> | |||
If successful, this call returns "OK" string and value, "error" and error description string otherwise. | |||
=== OS DLL Function === | |||
<highlight-nsis> | |||
WmiInspector::OS | |||
</highlight-nsis> | |||
If successful, this call returns "OK" string and OS caption, "error" and error description string otherwise. | |||
This function is equivalent to '''''WmiInspector::Request "CIMV2" "Win32_OperatingSystem" "Caption"'''''. | |||
=== OSVersion DLL Function === | |||
=== DLL Function === | <highlight-nsis> | ||
WmiInspector::OSVersion | |||
</highlight-nsis> | |||
If successful, this call returns "OK" string and OS version number, "error" and error description string otherwise. | |||
This function is equivalent to '''''WmiInspector::Request "CIMV2" "Win32_OperatingSystem" "Version"'''''. | |||
=== FullOS DLL Function === | |||
<highlight-nsis> | |||
WmiInspector::FullOS | |||
</highlight-nsis> | |||
If successful, this call returns "OK" string and full OS informations (including version number and service pack), "error" and error description string otherwise. | |||
This function is a combination of several '''''WmiInspector::Request "CIMV2" "Win32_OperatingSystem" "Xxx"''''' calls. | |||
=== UserName DLL Function === | |||
<highlight-nsis> | |||
WmiInspector::UserName | |||
</highlight-nsis> | |||
If successful, this call returns "OK" string and current logged user name, "error" and error description string otherwise. | |||
This function is equivalent to '''''WmiInspector::Request "CIMV2" "Win32_ComputerSystem" "UserName"'''''. | |||
=== ShortUserName DLL Function === | |||
<highlight-nsis> | |||
WmiInspector::ShortUserName | |||
</highlight-nsis> | |||
If successful, this call returns "OK" string and current logged user name (without path), "error" and error description string otherwise. | |||
This function is a combination of operation and can't be executed with ''''WmiInspector::Request'''''. | |||
=== UserSID DLL Function === | |||
<highlight-nsis> | |||
WmiInspector::UserSID "name_of_the_user" | |||
</highlight-nsis> | |||
If successful, this call returns "OK" string and Security Identifier (SID) of the provided user name, "error" and error description string otherwise. | |||
This function is merely equivalent to '''''WmiInspector::Request "CIMV2" "Win32_UserAccount" "SID"''''' with WHERE clause equal to Name = 'name_of_the_user'. | |||
These values are fixed and can't be changed for now so you can't use Request. | |||
=== AntiVirus DLL Function === | |||
<highlight-nsis> | |||
WmiInspector::AntiVirus | |||
</highlight-nsis> | |||
If successful, this call returns "OK" string and installed antivirus name, "error" and error description string otherwise. | |||
This function is equivalent to '''''WmiInspector::Request "SecurityCenter" "AntiVirusProduct" "DisplayName"'''''. | |||
=== FireWall DLL Function === | |||
<highlight-nsis> | |||
WmiInspector::FireWall | |||
</highlight-nsis> | |||
If successful, this call returns "OK" string and installed firewallname, "error" and error description string otherwise. | |||
This function is equivalent to '''''WmiInspector::Request "SecurityCenter" "FirewallProduct" "DisplayName"'''''. | |||
=== CPU DLL Function === | |||
<highlight-nsis> | |||
WmiInspector::CPU | |||
</highlight-nsis> | |||
If successful, this call returns "OK" string and CPU name, "error" and error description string otherwise. | |||
This function is equivalent to '''''WmiInspector::Request "CIMV2" "Win32_Processor" "Caption"'''''. | |||
=== Resolution DLL Function === | |||
<highlight-nsis> | |||
WmiInspector::Resolution | |||
</highlight-nsis> | |||
If successful, this call returns "OK" string and desktop resolution, "error" and error description string otherwise. | |||
This function is a combination of several '''''WmiInspector::Request "CIMV2" "Win32_Win32_DesktopMonitor" "Xxx"''''' calls. | |||
=== SQLVersion DLL Function === | |||
<highlight-nsis> | |||
WmiInspector::SQLVersion | |||
</highlight-nsis> | |||
If successful, this call returns "OK" string and SQL version number, "error" and error description string otherwise. | |||
This function is merely equivalent to '''''WmiInspector::Request "Microsoft\\SqlServer\\ComputerManagement" "SqlServiceAdvancedProperty" "PropertyStrValue"''''' with WHERE clause equal to SQLServiceType = 1 AND PropertyName = 'SKUNAME'. | |||
These values are fixed and can't be changed for now so you can't use Request. | |||
[http://support.microsoft.com/?scid=kb%3Ben-us%3B321185&x=12&y=17 You can find SQL Version explanation here] | |||
=== FullSQLVersion DLL Function === | |||
<highlight-nsis> | |||
WmiInspector::FullSQLVersion | |||
</highlight-nsis> | |||
If successful, this call returns "OK" string and full SQL Server informations (including version number, service pack and edition name), "error" and error description string otherwise. | |||
This function is a combination of several '''''WmiInspector::Request "Microsoft\\SqlServer\\ComputerManagement" "Win32_SqlServiceAdvancedProperty" "Xxx"''''' calls. | |||
[http://support.microsoft.com/?scid=kb%3Ben-us%3B321185&x=12&y=17 You can find SQL Version explanation here] | |||
== Examples == | == Examples == | ||
<highlight-nsis> | <highlight-nsis> | ||
WmiInspector:: | ;Show OS name | ||
Pop $0 | START: | ||
Pop $1 | WmiInspector::Request "CIMV2" "Win32_OperatingSystem" "Caption" | ||
Pop $0 | |||
StrCmp $0 "ok" SHOWVALUE SHOWERROR | |||
SHOWVALUE: | |||
Pop $1 | |||
MessageBox MB_OK "Value: $1" | |||
GoTo END | |||
SHOWERROR: | |||
Pop $1 | |||
MessageBox MB_OK "Error: $1" | |||
END: | |||
</highlight-nsis> | |||
<highlight-nsis> | |||
;Show Antivirus name | |||
START: | |||
WmiInspector::AntiVirus | |||
Pop $0 | |||
StrCmp $0 "ok" SHOWVALUE SHOWERROR | |||
SHOWVALUE: | |||
Pop $1 | |||
StrCmp $1 "" SHOWAVNAME NOAV | |||
SHOWAVNAME: | |||
MessageBox MB_OK "Antivirus detected: $1" | |||
GoTo END | |||
NOAV: | |||
MessageBox MB_OK "No antivirus found." | |||
GoTo END | |||
SHOWERROR: | |||
Pop $1 | |||
MessageBox MB_OK "Error: $1" | |||
END: | |||
</highlight-nsis> | </highlight-nsis> | ||
[[Category:Plugins]] | [[Category:Plugins]] |
Latest revision as of 13:25, 31 July 2008
Author: L0k1 (talk, contrib) |
Links
Download:
WmiInspector.zip (77 KB)
Description
This plugin sends request to the system using MS WMI API and returns the value on the stack. Plugin first returns "OK" if successfull, "error" if failed then the requested value or the error description.
Rem: An empty string might be returned as a result for the requested value. This doesn't mean that an error occurs but that there's not information for this value. See Antivirus exemple.
Command line
Plug-in DLL functions (entry points): Request, OS, OSVersion, FullOS, AntiVirus, FireWall, CPU, Resolution, SQLVersion, FullSQLVersion
Request DLL Function
WmiInspector::Request DomainName TableName ValueName
If successful, this call returns "OK" string and value, "error" and error description string otherwise.
OS DLL Function
WmiInspector::OS
If successful, this call returns "OK" string and OS caption, "error" and error description string otherwise.
This function is equivalent to WmiInspector::Request "CIMV2" "Win32_OperatingSystem" "Caption".
OSVersion DLL Function
WmiInspector::OSVersion
If successful, this call returns "OK" string and OS version number, "error" and error description string otherwise.
This function is equivalent to WmiInspector::Request "CIMV2" "Win32_OperatingSystem" "Version".
FullOS DLL Function
WmiInspector::FullOS
If successful, this call returns "OK" string and full OS informations (including version number and service pack), "error" and error description string otherwise.
This function is a combination of several WmiInspector::Request "CIMV2" "Win32_OperatingSystem" "Xxx" calls.
UserName DLL Function
WmiInspector::UserName
If successful, this call returns "OK" string and current logged user name, "error" and error description string otherwise.
This function is equivalent to WmiInspector::Request "CIMV2" "Win32_ComputerSystem" "UserName".
ShortUserName DLL Function
WmiInspector::ShortUserName
If successful, this call returns "OK" string and current logged user name (without path), "error" and error description string otherwise.
This function is a combination of operation and can't be executed with 'WmiInspector::Request.
UserSID DLL Function
WmiInspector::UserSID "name_of_the_user"
If successful, this call returns "OK" string and Security Identifier (SID) of the provided user name, "error" and error description string otherwise.
This function is merely equivalent to WmiInspector::Request "CIMV2" "Win32_UserAccount" "SID" with WHERE clause equal to Name = 'name_of_the_user'. These values are fixed and can't be changed for now so you can't use Request.
AntiVirus DLL Function
WmiInspector::AntiVirus
If successful, this call returns "OK" string and installed antivirus name, "error" and error description string otherwise.
This function is equivalent to WmiInspector::Request "SecurityCenter" "AntiVirusProduct" "DisplayName".
FireWall DLL Function
WmiInspector::FireWall
If successful, this call returns "OK" string and installed firewallname, "error" and error description string otherwise.
This function is equivalent to WmiInspector::Request "SecurityCenter" "FirewallProduct" "DisplayName".
CPU DLL Function
WmiInspector::CPU
If successful, this call returns "OK" string and CPU name, "error" and error description string otherwise.
This function is equivalent to WmiInspector::Request "CIMV2" "Win32_Processor" "Caption".
Resolution DLL Function
WmiInspector::Resolution
If successful, this call returns "OK" string and desktop resolution, "error" and error description string otherwise.
This function is a combination of several WmiInspector::Request "CIMV2" "Win32_Win32_DesktopMonitor" "Xxx" calls.
SQLVersion DLL Function
WmiInspector::SQLVersion
If successful, this call returns "OK" string and SQL version number, "error" and error description string otherwise.
This function is merely equivalent to WmiInspector::Request "Microsoft\\SqlServer\\ComputerManagement" "SqlServiceAdvancedProperty" "PropertyStrValue" with WHERE clause equal to SQLServiceType = 1 AND PropertyName = 'SKUNAME'. These values are fixed and can't be changed for now so you can't use Request.
You can find SQL Version explanation here
FullSQLVersion DLL Function
WmiInspector::FullSQLVersion
If successful, this call returns "OK" string and full SQL Server informations (including version number, service pack and edition name), "error" and error description string otherwise.
This function is a combination of several WmiInspector::Request "Microsoft\\SqlServer\\ComputerManagement" "Win32_SqlServiceAdvancedProperty" "Xxx" calls.
You can find SQL Version explanation here
Examples
;Show OS name START: WmiInspector::Request "CIMV2" "Win32_OperatingSystem" "Caption" Pop $0 StrCmp $0 "ok" SHOWVALUE SHOWERROR SHOWVALUE: Pop $1 MessageBox MB_OK "Value: $1" GoTo END SHOWERROR: Pop $1 MessageBox MB_OK "Error: $1" END:
;Show Antivirus name START: WmiInspector::AntiVirus Pop $0 StrCmp $0 "ok" SHOWVALUE SHOWERROR SHOWVALUE: Pop $1 StrCmp $1 "" SHOWAVNAME NOAV SHOWAVNAME: MessageBox MB_OK "Antivirus detected: $1" GoTo END NOAV: MessageBox MB_OK "No antivirus found." GoTo END SHOWERROR: Pop $1 MessageBox MB_OK "Error: $1" END: