Important Notice: On February 29th, this community was put into read-only mode. All existing posts will remain but customers are unable to add new posts or comment on existing. Please feel to join our Community Discord for any questions and discussions.

does Custom Tool really run a command?

When creating a custom tool in the PDQ Inventory preferences there is a section labeled as Command:

I simply want it to run a command that will delete the contents of the computers temp folder like the following: Del /Q /S \\%Target%\C$\Windows\Temp\*.*

However when this is used PDQ throws and error saying the file cannot be found. The only way I have found to get it to work is by creating a batch script file that does the same thing and tell the custom tool to run the batch script.

Why can't it just run the command without needing to setup script files on my PDQ computer?

0

Comments

4 comments
Date Votes
  • Hi Mmuni,

    To answer your question, it does run a command, but more along the lines of Start > Run than invoking cmd.exe. To achieve the results you want from the above example, this should work:

    cmd.exe /c "Del /Q /S %systemroot%\Temp\*.*"
    0
  • Ok, so I would need to add the cmd.exe /c and wrap it in quotes? I'm not deleting my temp folder but instead deleting the temp folder on the selected target machine.

    0
  • I think I misunderstood. To run it on any number of remote machines, you would use something like this, otherwise, yes, it would only run on the local machine:

    cmd.exe /c "Del /Q /S \\%TARGETHOSTNAME%\c$\Windows\Temp\*.*"

    You can test this by running a simple dir command with the /k switch:

    cmd.exe /k "dir \\%TARGETHOSTNAME%\c$\Windows\"

    EDIT:
    And if you wanted this to run the command on any number of machines or an entire collection, you could always use the Tools > Remote Command, and simply run the command (no need to invoke cmd.exe), Del /Q /S %systemroot%\Temp\*.*, which will run remotely on each selected machine.

    0
  • works great, now I can get rid of all the Batch Files I created for custom tools.

    0