Reply To: Powershell scripts do not show output

Chris ColemanChris Coleman
-1 pt

Hello Ybeees,

Thank you for reaching out to us. It looks like there may be an issue with the script that you were running. You will be able to execute both batch and PowerShell scripts from the Hexnode portal using the Custom Script feature. However, you will only obtain an output if the script contains a print command in it.
We have cumulated some troubleshooting points to help you run your scripts in the correct format:

  1. Initially, you can run your script manually on your Windows device to check whether the script is producing the expected output. If the script is not executed successfully, you may have to manually check the commands to correct your script.
  2. Running a simple batch script will always display the option Show Output. This is because a batch script will print all the commands in it unless you add the command @echo off. The output that is displayed when you click Show Output might just be the commands in the file.
  3. Unlike batch script, a PowerShell script will not print its commands. If you want to see the option Show Output, include the command Write-Host or Write-Output accompanied by the text you want to print.
  4. The absence of Show Output after executing a PowerShell script does not always indicate that the script has failed.

Hope this helps you out.

Chris Coleman
Hexnode UEM