I am new to PowerShell, but I am trying to use it to export an App list from windows, edit that App list, and re-import the updated App list. The problem is PowerShell does not want to run the last command. It stops after it has run the command to find and replace the variables. Can anyone advise on a solution?
#
#Variables
$path = 'C:\AppAssociations.xml'
$mail = '<Association Identifier="mailto" ProgId="AppXydk58wgm44se4b399557yyyj1w7mbmvd" ApplicationName="Mail" />'
$outlook = '<Association Identifier="mailto" ProgId="Outlook.URL.mailto.15" ApplicationName="Outlook" />'
$con = Get-Content $path
#
# Download App Associations xml
Dism /online /Export-DefaultAppAssociations:"$path";
#
# find and replace
$con | % { $_.Replace("$mail", "$outlook") } | Set-Content $path;
#
# Import updated App Associations xml
Dism /online /Import-DefaultAppAssociations:$path;
Get-Date