PowerShell script executed remains in Initiated stateSolved

Participant
Discussion
3 years ago

We have some scripting workflows, some of which works well with Hexnode’s remote script deployment and some have issues. One of the scripts when executed from the portal, keeps showing the Initiated state and we’re out of clue as to what is causing this behavior.

The script is adapted from https://support.google.com/a/answer/9250996?hl=fr and what it is doing is, it silently installs the Google Credential Provider for Windows (GCPW) and changes settingsi in the registry so that user can use Google user account as a local account on the Windows machine. No input is necessary during the execution of this script and we are able to run it successfully when executed manually in elevated mode PowerShell.
When this script is run, earlier it use to show the error as “Script execution failed. Validate the script and try again.”. Now, it is struck at Initiated state.

Any help is appreciated.

Replies (3)

Marked SolutionPending Review
Participant
3 years ago
Marked SolutionPending Review

If the script has any prompt or presentation then usually it fails. While examining the sample script found on the link you shared, many MessageBox class could be seen. It will display message boxes while the script is run. Maybe try removing that.

Marked SolutionPending Review
Hexnode Expert
3 years ago
Marked SolutionPending Review

Hi @Klara, if your System is a 64-bit system, this could be happening because the script is being run by a 32-bit application and hence, the registry key is created but on a 32-bit node. Could you try modifying the script to access the 64-bit node?

Also, adding to what @Yvonne suggested, the MessageBox dialogs could indeed cause problems and the recommended workaround would be to use Write-Host instead to produce a host –display-only output data.

Cheers!
Zach Goodman
Hexnode UEM

Marked SolutionPending Review
Participant
3 years ago
Marked SolutionPending Review

@zach-goodman thanks for your answer. We modified the script and now it works perfectly. What we observed from this exercise is that if we deviate even the slightest from the native PS script, remote script execution fails.