Remote Script Execution on Azure Arc enabled Servers using Custom Script Extension
This article has not been completed yet. However, it may already contain helpful Information and therefore it has been published at this stage.
$chocolateyAppList = "microsoft-windows-terminal,microsoft-edge,7zip,notepadplusplus"
if ([string]::IsNullOrWhiteSpace($chocolateyAppList) -eq $false -or [string]::IsNullOrWhiteSpace($dismAppList) -eq $false)
{
try{
choco config get cacheLocation
}catch{
Write-Output "Chocolatey not detected, trying to install now"
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
}
}
if ([string]::IsNullOrWhiteSpace($chocolateyAppList) -eq $false){
Write-Host "Chocolatey Apps Specified"
$appsToInstall = $chocolateyAppList -split "," | foreach { "$($_.Trim())" }
foreach ($app in $appsToInstall)
{
Write-Host "Installing $app"
& choco install $app /y 1 Write-Output
}
}
Note: Microsoft-Windows-Terminal is not supported on Windows Server 2019 Version 1809
powershell -ExecutionPolicy Unrestricted -File choco.ps1