简体   繁体   中英

windows customscriptextension fails

"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 "

• 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: "

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM