Help Center

Follow

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?
1 out of 1 found this helpful
Have more questions? Submit a request

2 Comments

  • 0

    Also... Please remember that a Custom Tool runs the command FROM the console system. This is the primary difference between a Custom Tool and a Remote Command. Remote Command runs the command FROM the target system.

    If you want to restart the DNS Client service on a target system via a Custom Tool then you would use:

    psservice \%TARGET% restart dnscache -accepteula

    Note that psservice must be accessible FROM THE CONSOLE MACHINE. See below for an example.

    Restart-Remote-DNS.png

  • 0

    Hello, where is the image Custom_Tool_-_System.png

    and other .png ??

     

    We tried to do this tutorial, but nothing is working. Do you have a video tutorial to solve our big recurrent problem : "computer name could not be found"

     

    Regard.

Article is closed for comments.
Powered by Zendesk