Problem with executing scripts (Windows)Solved

Participant
Discussion
3 years ago

Hi

Executing the script generates an error “script execution failed – validate the script and try again”. It occurs infrequently while running scripts from Hexnode. Any specific reasons for the same?

Replies (4)

Marked SolutionPending Review
Hexnode Expert
4 years ago
Marked SolutionPending Review

Hello @Maliyah,

Currently, the script execution has a 30 minutes timeout. Once executed, it should run to completion within this duration. The error message “Script execution failed – validate the script and try again” occurs when the execution is delayed and exceeds the stipulated time. Sometimes, it depends on the scripts and the associated commands that delay the execution (for instance, script to perform OS update, app installation, etc.), or it might be due to a corrupted script. In the latter case, the script should be validated to execute them successfully from the Hexnode portal.

Feel free to contact us for more queries,

Catherine George
Hexnode UEM

Marked SolutionPending Review
Participant
3 years ago
Marked SolutionPending Review

Well, executing custom scripts is an easy way to deploy custom configurations, and we have constantly been working on it to define enterprise-specific settings and configurations on Windows. In most cases, they run perfectly, but in certain instances, it acts out as they are executed from Hexnode stating, The term is not recognized as the name of a cmdlet, function, script file, or operable program. Yet, the script runs successfully when executed otherwise. We are pretty unsure of what the issue is.

Marked SolutionPending Review
Participant
3 years ago
Marked SolutionPending Review

Oh! That was really helpful. Thanks so much.

Marked SolutionPending Review
Hexnode Expert
3 years ago
Marked SolutionPending Review

A pleasure to be of help @Delilah,

Often, the error mentioned earlier ‘The term _____ is not recognized as the name of a cmdlet, function, script file, or operable program’ occurs when you attempt to run script commands on an unsupported CPU architecture type. Moreover, the scripts are run across 86-bit PowerShell on Windows devices when executed from the Hexnode portal. That’s why the script failed to execute.

If your script uses a module that requires the 64-bit version of PowerShell, you should specify it explicitly. For example, add the following commands to the beginning of your script to run it on 64-bit PowerShell.

Also, there are other commands available that will help you force 64-PowerShell on the devices. You may use them accordingly.

I hope it helps,

Catherine George
Hexnode UEM

Save