diff --git a/images/win/post-generation/Add-SshHostKeys.ps1 b/images/win/post-generation/Add-SshHostKeys.ps1 index 2ddeb131..114a98d6 100644 --- a/images/win/post-generation/Add-SshHostKeys.ps1 +++ b/images/win/post-generation/Add-SshHostKeys.ps1 @@ -1,4 +1,4 @@ # Add well-known SSH host keys to ssh_known_hosts ssh-keyscan -t rsa github.com >> "C:\Program Files\Git\etc\ssh\ssh_known_hosts" -ssh-keyscan -t dsa github.com >> "C:\Program Files\Git\etc\ssh\ssh_known_hosts" \ No newline at end of file +ssh-keyscan -t rsa ssh.dev.azure.com >> "C:\Program Files\Git\etc\ssh\ssh_known_hosts" \ No newline at end of file diff --git a/images/win/post-generation/Create-Junction.ps1 b/images/win/post-generation/Create-Junction.ps1 deleted file mode 100644 index a41f0f0c..00000000 --- a/images/win/post-generation/Create-Junction.ps1 +++ /dev/null @@ -1,30 +0,0 @@ -# Create Rust junction points to cargo and rustup folder -$cargoTarget = "$env:USERPROFILE\.cargo" -if (-not (Test-Path $cargoTarget)) -{ - New-Item -ItemType Junction -Path $cargoTarget -Target "C:\Rust\.cargo" - - if (Test-Path $cargoTarget) - { - Write-Host "Junction created for $cargoTarget <<===>> C:\Rust\.cargo" - } - else - { - Write-Host "Junction was not created for $cargoTarget" - } -} - -$rustupTarget = "$env:USERPROFILE\.rustup" -if (-not (Test-Path $rustupTarget)) -{ - New-Item -ItemType Junction -Path $rustupTarget -Target "C:\Rust\.rustup" - - if (Test-Path $rustupTarget) - { - Write-Host "Junction created for $rustupTarget <<===>> C:\Rust\.rustup" - } - else - { - Write-Host "Junction was not created for $rustupTarget" - } -} \ No newline at end of file diff --git a/images/win/post-generation/Create-RustJunction.ps1 b/images/win/post-generation/Create-RustJunction.ps1 new file mode 100644 index 00000000..86f3fc10 --- /dev/null +++ b/images/win/post-generation/Create-RustJunction.ps1 @@ -0,0 +1,12 @@ +# Create Rust junction points to cargo and rustup folder +$cargoTarget = "$env:USERPROFILE\.cargo" +if (-not (Test-Path $cargoTarget)) +{ + New-Item -ItemType Junction -Path $cargoTarget -Target "C:\Rust\.cargo" +} + +$rustupTarget = "$env:USERPROFILE\.rustup" +if (-not (Test-Path $rustupTarget)) +{ + New-Item -ItemType Junction -Path $rustupTarget -Target "C:\Rust\.rustup" +} \ No newline at end of file diff --git a/images/win/post-generation/Remove-AzureRegistrySettings.ps1 b/images/win/post-generation/Remove-AzureRegistrySettings.ps1 index d59f5375..e3a62d37 100644 --- a/images/win/post-generation/Remove-AzureRegistrySettings.ps1 +++ b/images/win/post-generation/Remove-AzureRegistrySettings.ps1 @@ -1,9 +1,7 @@ -# Script to address any current issues with images that could be easily worked around. $ErrorActionPreference="Stop" -# Remove 3 registry settings that are left behind when sysprepping. Having those registry settings together with a +# Remove 3 registry settings that are left behind when sysprepping. Having those registry settings together with a # race condition that kicks in when trying to run custom scripts extensions and stops us from reimaging machines. -# ICM: https://portal.microsofticm.com/imp/v3/incidents/details/191973270/home Remove-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Azure\HandlerState' -Name 'Incarnation' -Force -ErrorAction Ignore Remove-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Azure\HandlerState' -Name 'InVmSvdSeqNo' -Force -ErrorAction Ignore Remove-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Azure\HandlerState' -Name 'LastGoalStateMethod' -Force -ErrorAction Ignore diff --git a/images/win/post-generation/Set-RunnerToolCache.ps1 b/images/win/post-generation/Set-RunnerToolCache.ps1 deleted file mode 100644 index 3f11343c..00000000 --- a/images/win/post-generation/Set-RunnerToolCache.ps1 +++ /dev/null @@ -1,14 +0,0 @@ -if ([string]::IsNullOrEmpty($env:RUNNER_TOOL_CACHE)) -{ - $env:RUNNER_TOOL_CACHE=$env:AGENT_TOOLSDIRECTORY - [System.Environment]::SetEnvironmentVariable('RUNNER_TOOL_CACHE', $env:AGENT_TOOLSDIRECTORY, [System.EnvironmentVariableTarget]::Machine) - Write-Host "RUNNER_TOOL_CACHE set to match AGENT_TOOLSDIRECTORY: $env:RUNNER_TOOL_CACHE" - - [System.Environment]::SetEnvironmentVariable('AGENT_TOOLSDIRECTORY', $null, [System.EnvironmentVariableTarget]::Machine) - $isAgentToolsDirectoryNotThere = [string]::IsNullOrEmpty($env:RUNNER_TOOL_CACHE) - Write-Host "AGENT_TOOLSDIRECTORY deleted: $isAgentToolsDirectoryNotThere" -} -else -{ - Write-Host "RUNNER_TOOL_CACHE non-empty: $env:RUNNER_TOOL_CACHE" -} diff --git a/images/win/post-generation/Update-WindowsPath.ps1 b/images/win/post-generation/Update-DotnetPath.ps1 similarity index 61% rename from images/win/post-generation/Update-WindowsPath.ps1 rename to images/win/post-generation/Update-DotnetPath.ps1 index ef84a6e2..c051ebd4 100644 --- a/images/win/post-generation/Update-WindowsPath.ps1 +++ b/images/win/post-generation/Update-DotnetPath.ps1 @@ -1,18 +1,5 @@ -$isPathUpdated = $false -$hgPath = "$Env:ProgramFiles\Mercurial\" $latestPath = [System.Environment]::GetEnvironmentVariable('PATH', [System.EnvironmentVariableTarget]::Machine) -if (Test-Path -Path $hgPath) -{ - $latestPath = "$hgPath;$latestPath" - Write-Host "Added Mercurial to PATH" - $isPathUpdated = $true -} -else -{ - Write-Host "Didn't find Mercurial at $hgPath. Skipping adding PATH to it." -} - $dotnetPath = "$env:USERPROFILE\.dotnet\tools" if ($latestPath.Contains("C:\Users\VssAdministrator\.dotnet\tools")) { @@ -31,9 +18,5 @@ else Write-Host "$dotnetPath already in PATH" } -if ($isPathUpdated) -{ - [System.Environment]::SetEnvironmentVariable('PATH', $latestPath, [System.EnvironmentVariableTarget]::Machine) -} $updatedPath = [System.Environment]::GetEnvironmentVariable('PATH', [System.EnvironmentVariableTarget]::Machine) Write-Host "Windows PATH: $updatedPath" \ No newline at end of file diff --git a/images/win/post-generation/Update-MercurialPath.ps1 b/images/win/post-generation/Update-MercurialPath.ps1 new file mode 100644 index 00000000..de68e181 --- /dev/null +++ b/images/win/post-generation/Update-MercurialPath.ps1 @@ -0,0 +1,16 @@ +$hgPath = "$Env:ProgramFiles\Mercurial\" +$latestPath = [System.Environment]::GetEnvironmentVariable('PATH', [System.EnvironmentVariableTarget]::Machine) + +if (Test-Path -Path $hgPath) +{ + $latestPath = "$hgPath;$latestPath" + Write-Host "Added Mercurial to PATH" + $isPathUpdated = $true +} +else +{ + Write-Host "Didn't find Mercurial at $hgPath. Skipping adding PATH to it." +} + +$updatedPath = [System.Environment]::GetEnvironmentVariable('PATH', [System.EnvironmentVariableTarget]::Machine) +Write-Host "Windows PATH: $updatedPath" \ No newline at end of file