I am trying to create a host pool VM using the "Custom configuration" option. The custom solution suggested in the instructions (https://raw.githubusercontent.com/Azure/RDS-Templates/master/wvd-sh/arm-template-customization/script.ps1) does not seem to have done anything. For example, the Edge OOBE is unchanged.
The "Learn more" link goes to https://github.com/Azure/RDS-Templates/tree/master/wvd-sh/arm-template-customization
As an experiment, I tried connecting directly to the VM through a bastion using the local admin user/pass, and tried running the solution script manually. There, the error was:
File C:UserslocaladminVD0TVirtual-Desktop-Optimization-Tool-mainWindows_VDOT.ps1 cannot be
loaded because running scripts is disabled on this system.
For more information, see about_Execution_Policies at https://go.microsoft.com/fwlink/?LinkID=135170.
That may be a distraction though, as the execution environment for "Custom configuration" may be different.
2
Answers
As explained in comment, your execution policy is set to restricted that’s why you are getting the blocker.
Your script works when remote signed or unrestricted but fails when restricted.
Check your execution policy using
and then if restricted change it to remote signed or unrestricted.
According to the instructions found at https://github.com/Azure/RDS-Templates/tree/master/wvd-sh/arm-template-customization, you are not supposed to be linking to the
script.ps1
file directly because you will encounter the issue you’re running into. They instruct users to link to thesolution.json
andsolution.parameters.json
files instead, which (if you look inside of it) sets the PowerShell execution policy to Unrestricted when it calls thescript.ps1
file.So, download the .ps1 and .json files at https://github.com/Azure/RDS-Templates/tree/master/wvd-sh/arm-template-customization, set the custom configuration script field to contain the URLs where you’ve stored
solution.json
,solution.parameters.json
, andscript.ps1
, and it should successfully run thescript.ps1
file without an execution policy failure.Unfortunately, following their instructions shows that the field does not allow anything other than URLs pointing to .ps1 files directly. I’m not sure what the solution would be in this case, as it seems to be a broken process.