Mar 12 2010

Diagnosis tool for your helpldesk SN1-info v1.0

Here is an application for your helpdesk that collects data about the user environment which can be useful for troubleshooting, It was developed using WMI code creator was really useful for coding this application.

Just click on the icon bellow to download the tool, if you notice any bugs and have any ideas for tool evolution, please do not hesitate to contact me.

After launching the application just input the remote computer name.

Then the user information using the following syntax domainusername:

A window with five thumbnails is displayed:

General info:

This thumbnail is divided in two parts, the first one is just basic WMI queries:

The “Network info” is a bit more tricky to code: If you browse the Win32_NetworkAdapterConfiguration WMI class on a server with teaming network adapters or on a laptop a lot of network cards are returned by the query, but the information on most of these cards is irrelevant. A scripting guys post led me to the answer: First we need to check first network adapters which are connected to the network, for this you need to check “NetConnectionStatus” value of the Win32_NetworkAdapter WMI class, then retrieve information given by the Win32_NetworkAdapterConfiguration WMI class for network cards which have IP enabled. The way to link those classes is the “caption” value which exists on both WMI classes. So we use two queries to collect network information, you can edit the HTA file and you will find those queries:

1
2
3
4
5
6
7
8
Set colItems = objWMIService.ExecQuery("SELECT caption FROM Win32_NetworkAdapter WHERE NetConnectionStatus = 2")
For Each objItem in colItems
caption1 = objItem.caption
Set colNicConfigs = objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True AND caption = '"&caption1&"'")
For Each objNicConfig In colNicConfigs
'Retrieve IP adress, DNS servers....
Next
Next

Now let’s have a look at the second thumbnail.

Printers:

To retrieve the information displayed on this thumbnail we use WMI classes again, In the tab you can see the driver name and printer type: Network or local. Default printer is highlighted in blue.

In order to determine if it is a network or a local printer just ask the scripting guys, the tool works with Windows 2000 as well, using the methodology described in their post. Still we noticed that using Win32_Printer class sometimes didn’t work to list network printers on remote computers, in that case we retrieve information from the registry HKCU\Printers\Connections (HKUSERS\%User_SID%\Printers\Connections), niether the default printer could be found nor the driver name. The cause of the problem is that your account cannot browse remotely the WMI namespace of network printers because they are declared per user. If you want your WMI query to return results you should use the credentials of the remote user, to perform this operation read this article.

Active Directory:

In this thumbnail we display the logon server used by remote user. Then the resultant set of policy, computer and user configuration:

The WMI root\rsop\computer class is used to retrieve the computer configuration resultant set of policy, for user configuration it is a bit more tricky. You need to call the root\rsop\user\%User_SID% class but you have to replace the SID’s dashes by underscores. Here is the sample code used:

1
2
3
4
5
6
7
8
9
10
11
12
Set objAccount = objWMIService.Get("Win32_UserAccount.Name='"&usser&"',Domain='"&domaine&"'")
SID=replace(objAccount.SID,"-","_")
Set objWMIGPO = GetObject("winmgmts:" & strComputer & "root\rsop\user"&SID)
 
Set colGPO = objWMIGPO.ExecQuery("Select * from RSOP_GPO")
 
For Each objGPO in colGPO
version = hex(objGPO.Version)
version = right(version,4)
version = CLng("&H" & version)
'Collect other information
Next

As you can see GPO version is not obvious to collect because it is a combination of GPC an GPT version, in our script GPC version is returned. For more information about the root\rsop class check this link.

Hotfixes:

This thumbnail indicates if Windows Update is turned on and if a WSUS is used to download hotfixes, all relevant information can be found in the registry. Hotfixes installed on your computer can be found via the Win32_QuickFixEngineering class.

Citrix:

Here we have the ICA client version, have a look at this old CTX for methodology. Then PN Agent URL is displayed if available.

This post is also available in: French

1 Comment

  • By nyaplustech, July 9, 2014 @ 4:40 pm

    Unbelievably cool utility, extremely useful, thank you for sharing!

Other Links to this Post

RSS feed for comments on this post. TrackBack URI

Leave a comment

*

WordPress Themes

Blossom Icon Set

Software Top Blogs