I got anonymous reader comment on continuing the series for how to use WBEMTEST to get WMI data
In this article I will add two points to cover in this fabulous tool
1- Connect to remote node
2- Run WQL queries.
Connect to remote node
usually we use wbemtest locally to access local classes, but WMI support access to remote computers naturally and for applications like PowerShell version 1 which support local scripting, it uses WMI to expand its functionality and to allow PowerShell access to remote computers.
Anyhow, we can use WBEMTEST utility to achieve this by using the connect button located on the main screen, we usually use root\ to locate our local classes like ROOT\MicrosoftIISv2 to get the status for website hosted on IIS server
but if the IIS is not hosted on my local machine I can query this server by adding \\servername\ROOT\MicrosoftIISv2 so it will look like “unified naming convention” UNC same like the one used for Windows file sharing, also you can use Credentials section to access the remote system with different account.
Run WQL query to retrieve data from WMI classes.
WMI supports a subset of Structured Query Language that support WMI event and WMI-Specific features which we can use to filter the content of the data (instances) within a class like select certain attributes or limit the number of instance.
My 1st encounter to WQL was in Windows Server 2003 group policy where you can filter the group policy application to only certain set of computers based on certain attributes like OS version and Service Pack or disk free space.
In our tool we can use Query button to write our query
Press Apply to get the result
You can try to use
Select * from Win32_LogicalDisk where FreeSpace > 104857600
To list only drives where is have diskspace more than 100 MB
for more statements check http://technet.microsoft.com/en-us/library/cc779036(WS.10).aspx
No comments:
Post a Comment