0

"commandToExecute": "powershell.exe -executionpolicy Unrestricted -File "./Add-WVDHostToHostpoolSpringORG4T.ps1" "

fails with the below error

Error: Code="VMExtensionProvisioningError" Message="VM has reported a failure when processing extension 'CustomScriptExtension'. Error message: "Command execution finished, but failed because it returned a non-zero exit code of: '1'. The command had an error output of: 'At \r\nC:\Packages\Plugins\Microsoft.Compute.CustomScriptExtension\1.10.12\Downloads\0\Add-WVDHostToHostpoolSpringORG4T.ps1:1 \r\nchar:1\r\n+ <#\r\n+ ~~\r\nThe terminator '#>' is missing from the multiline comment.\r\n + CategoryInfo : ParserError: (:) [],...' For more information, check the instance view by executing Get-AzVmssVm or Get-AzVm (https://aka.ms/GetAzVm). These commands can be executed using CloudShell (https://aka.ms/CloudShell)"\r\n\r\nMore information on troubleshooting is available at https://aka.ms/VMExtensionCSEWindowsTroubleshoot "

Kartik Bhiwapurkar
  • 4,550
  • 2
  • 4
  • 9
tandey
  • 11
  • 2
  • Hi @tandey, did the suggested solution work for you? Do let me know if it solved your problem else share more details so I can troubleshoot or else do accept it for helping other community members. – Kartik Bhiwapurkar Aug 05 '22 at 04:12
  • Hi I figured out the problem was that in the reference script I didnt closed the comment – tandey Aug 06 '22 at 06:56

1 Answers1

0

• I would suggest you to please try executing the powershell script on a separate test VM first to ensure that the desired results are being achieved through the script. Also, would suggest you to please refer the below community thread for the appropriate usage of parameters to be used in custom script extension while deploying powershell script through it.

Install applications or software on Azure VM with ARM Template

Also, according to the error that you have encountered, it seems that you have missed adding a ‘#’ mark before as a prefix to the supposed comment remark in the script due to which the powershell script when executed is giving out an error stating the same. Or else that you might have added an extra ‘#’ mark before a supposed legit powershell command in the script due to which the script didn’t get executed and is giving out this error.

Kindly refer the below community thread also for more details into this: -

powershell is missing the terminator: "

Kartik Bhiwapurkar
  • 4,550
  • 2
  • 4
  • 9