Allow use of Configuration Task when deploying Visual Studio Code

When deploying Visual Studio Code (from global repo), there is no option to specify a configuration task. Specifically what I’m trying to do is make it the default editor when one right-clicks a PS1 and chooses “edit”

@Jake_Molko configuration task has been added that allows you to list the file associations you would like to be set to open with Visual Studio Code.

This changes the “default app” for .ps1, but we also need to change what happens when you right-click a PS1 in Windows Explorer and click “Edit,” which is not the same. Specifically, a registry key needs modified at HKEY_CLASSES_ROOT_SystemFileAssociations.ps1\Shell\Edit\Command

This is what I had done to get it to work, although I’m sure there’s probably a much more elegant way of doing it:

$regtestpath = Get-WindowsRegistryValue -Path ‘REGISTRY::HKEY_CLASSES_ROOT\SystemFileAssociations.ps1\Shell\Edit\Command’ -Name “(Default)”
$proper_regvalue = ‘"’ + “C:\Program Files\Microsoft VS Code\Code.exe” + ‘"’ + " " + ‘“%1”’

if ($regtestpath -ne $proper_regvalue) {
Get-WindowsRegistryValue -Path ‘REGISTRY::HKEY_CLASSES_ROOT\SystemFileAssociations.ps1\Shell\Edit\Command’ -Name “(Default)” | RegistryShould-Be -Value $proper_regvalue
return $true
}

return $true

This is all that’s needed in a combined task script (presmuming all of the quoting is correct):

Get-WindowsRegistryValue -Path 
"HKCR:\SystemFileAssociations\.ps1\Shell\Edit\Command" -Name "(Default)" | RegistryShould-Be -Value  '"' + "C:\Program Files\Microsoft VS Code\Code.exe" + '"' + " " + '"%1"'

Ok, but I can’t edit anything because it’s global

You don’t need to–just create a separate task and deploy it.

Can it be added as a parameter to the global software deployment?