danielsollondon / azvmimagebuilder

Azure VM Image Builder
180 stars 153 forks source link

DEVOPS Azure VM Image Builder Task - Install RSAT Tools #113

Closed ShaunBaldwin closed 7 months ago

ShaunBaldwin commented 3 years ago

Hiya , I'm having problems installing the RSAT tools onto a W1021H1 EVD build during the build task. I've tried various different ways. The command is:

Get-WindowsCapability -Name RSAT* -Online | Add-WindowsCapability -Online

If I enter & 'c:\buildArtifacts\DIR\RSAT.ps1' in the Inline customization script field it runs but fails with:

PACKER OUT ==> azure-arm: Add-WindowsCapability : Access is denied.

If I try to construct an array of inline commands then it always fails with an error of Unexpected token as per below. Its as though the JSON doesn't get parsed or constructed correctly?

PACKER ERR 2021/05/26 10:49:17 packer-provisioner-powershell plugin: Found command: {"inline":["Get-WindowsCapability -Name RSAT* -Online | Add-WindowsCapability -Online"],"elevated_user":"SYSTEM","elevated_password":""}

PACKER OUT ==> azure-arm: Unexpected token ':["Get-WindowsCapability -Name RSAT* -Online | Add-WindowsCapability -Online"]' in expression or

I've also tried just adding just the command in the inline window or running '& set-executionpolicy remotesigned -scope Process -Force; c:\BuildArtifacts\DIR\RSAT.ps1'

_In either of these cases it seems to accept the command but i can find no evidence in the completed image that they have run.

Any ideas? Many Thanks_

danielsollondon commented 7 months ago

Apologies for the delay here, if you see this issue still, please raise here: https://github.com/azure/azvmimagebuilder