What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general.

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
More than 500,000 users rely on Paessler PRTG every day. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags

View all Tags

dnscmd.exe environment variable in powershell



Hello experts,

I am trying to implement a prtg script in which I am using dnscmd.exe in order to get the dns server insights but I am getting this error in the sensor logs.

dnscmd : The term 'dnscmd' is not recognized as the name of a cmdlet, 
function, script file, or operable program. Check the spelling of the name, or 
if a path was included, verify that the path is correct and try again.
At C:\Program Files (x86)\PRTG Network Monitor\custom 
sensors\EXEXML\Sensor-Server.ps1:279 char:50
+ $queriesrecieved = Invoke-Command -ScriptBlock {(dnscmd  /statistics 
00000002  | ...
+                                                  ~~~~~~
    + CategoryInfo          : ObjectNotFound: (dnscmd:String) [], CommandNotFo 
    + FullyQualifiedErrorId : CommandNotFoundException

Can any experts help me in this....I know there is something related to the environment variable.... Please help.

dns prtg wmi

Created on Nov 26, 2015 5:48:44 PM

Last change on Nov 27, 2015 12:22:12 PM by  Torsten Lindner [Paessler Support]

2 Replies



Hi Frank,

In your script, did you provide the full path to the dnscmd.exe ?

Created on Nov 27, 2015 7:56:12 AM




Thanks for the reply....

The problem got solved.........

I added the environment variable path of the dnscmd.exe

$env:Path = $env:Path + ';C:\windows\sysnative'

Created on Nov 27, 2015 12:25:59 PM

Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.