Quote from: Andrew Jimenez on November 02, 2020, 11:54:23 AM
So does Option 1 not work on newer clients? We may be able to incorporate Option 2 as a post-script, we'll discuss internally and see if we can add this directly to the product.
Thank you so much for providing this info!
I have not tested the registry option, mostly as they specifically called out that it did not work with later versions. Here is the full script I am now using, take whatever you need from it.
Code Select
#requires -version 3
<#
.SYNOPSIS
WorkspacesClient_Custom_PostInstall
.DESCRIPTION
PatchMyPC Customization Script for Amazon Workspaces Client
.NOTES
Version: 1.0
Author: Christopher Macnichol
Creation Date: 11/02/2020
Purpose/Change: Initial script development
11/02/2020 - 1.0 - Chris Macnichol - Initial Script Development
#>
try
{
$configFileX64 = "${env:ProgramFiles(x86)}\Amazon Web Services, Inc\Amazon WorkSpaces\workspaces.dll.config"
$configFileX86 = "$env:ProgramW6432\Amazon Web Services, Inc\Amazon WorkSpaces\workspaces.dll.config"
If (Test-Path -Path $configFileX64 -ErrorAction SilentlyContinue){ $configFile = $configFileX64}
elseif (Test-Path -Path $configFileX86 -ErrorAction SilentlyContinue){ $configFile = $configFileX86}
else {$configFile = $null}
If ($configFile) {
$xml = [xml]([System.IO.File]::ReadAllText($configFile))
$xml.PreserveWhitespace = $true
# Remove Update URL from Attribute
$key = $xml.SelectNodes('//configuration/appSettings/*') | Where-Object {$_.key -eq 'UpdateUrl'}
$key.Value = ''
#Settings object will instruct how the xml elements are written to the file
$settings = New-Object -TypeName System.Xml.XmlWriterSettings
$settings.Indent = $true
#NewLineChars will affect all newlines
$settings.NewLineChars ="`r`n"
#Set an optional encoding, UTF-8 is the most used (without BOM)
$settings.Encoding = New-Object -TypeName System.Text.UTF8Encoding -ArgumentList ( $false )
$file = [System.Xml.XmlWriter]::Create($configFile, $settings)
try{
$xml.Save( $file )
} finally{
$file.Dispose()
}
}
}
catch
{
('Error was {0}' -f $_)
$line = $_.InvocationInfo.ScriptLineNumber
('Error was in Line {0}' -f $line)
Exit 1602
}
Exit 0