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 
   undException
    + FullyQualifiedErrorId : CommandNotFoundException
 

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


Article Comments

Hi Frank,

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


Nov, 2015 - Permalink

Hello,

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'


Nov, 2015 - Permalink