Calling SysInternals tools from within PDQ Inventory

PDQ Inventory (Pro mode) has a cool feature called Custom Tools. This feature allows you to utilize utilities, scripts or commands that you use in your everyday life as a System Administrator.

In this discussion I am going to define a custom tool to utilize PSService.exe restart the DNS Client service. PSService is part of the famous pstools from SysInternals. I've used these tools for years going to back to when they were called NTInternals. I recommend downloading and installing these tools on your PDQ Inventory console machine. I always extract them and place them in my %WINDIR% directory (that way they are always in my %PATH%).

I am going to create this particular custom tool because of the annoyance I have when my DNS Cache just needs to be scrubbed.

The first time you run PSTools on a machine you will need to accept the EULA. You can suppress this message by adding the

-accepteula

argument to your command.

Open up PDQ Inventory. Hit CTRL+, or go to File / Preferences. Select the Custom Tools panel. Refer to the images below to see how I set this up on my console machine. Note that I placed the pstools in a folder called SysInternals under Windows.

CustomToolPSService.png

Then I can run the command via my Tools menu. Note - The "System Tool" check box means that I want this command to be run regardless of whether or not a computer or collection is selected. In this case since the command that I am running is respective to my console machine I want to it to run even if I don't have a computer selected. If, however, you want a command to be run that will run on a target computer you don't want this item checked.

This example you can see that I can access now restart the DNS Client service on a computer called Abraham by accessing the command from the Tools menu (I could also have just selected the computer and typed in CTRL+ALT+4)

RunCustomToolFromComputerWindow.png

If you didn't want to use PSService and just run a good ol' fashioned FlushDNS on your system you could have your command line be:

cmd /c ipconfig /flushdns

Though it is my experience (anecdotally I know) that restarting the DNS Client service (dnscache) is more effective.

You could also just use the built in SC.EXE command in Windows to stop and restart the service. I don't like this method because I have to perform two actions as opposed to the one command with PSService. (Actually 3 commands since I put a fake ping in the command to force a slight pause between the stop and start of the service)

cmd /c sc stop dnscache & ping nobody -n 2 & sc start dnscache

I still recommend using the PSTools whenever you can. They are amazingly helpful for any Windows system administrator.

Thanks to Neil for requesting this.

Was this article helpful?
Still have a question or want to share what you have learned? Visit our Community Discord to get help and collaborate with others.