skip to Main Content

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.

screenshot of host pool vm config wizard

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


  1. 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.

    enter image description here

    Check your execution policy using

    Get-ExecutionPolicy -List
    

    and then if restricted change it to remote signed or unrestricted.

    Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser -Force
    

    enter image description here

    Login or Signup to reply.
  2. 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 the solution.json and solution.parameters.json files instead, which (if you look inside of it) sets the PowerShell execution policy to Unrestricted when it calls the script.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, and script.ps1, and it should successfully run the script.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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search