DanysysTeam / PS-SFTA

PowerShell Set File Type Association
253 stars 53 forks source link

Issues on 21H2 #10

Closed wpltechstaff closed 2 years ago

wpltechstaff commented 2 years ago

We are desperately trying to get Adobe Reader to be the default application for PDF files (rather than Edge). Currently on Windows 10 21H2, the FTA keeps getting reset to MSEdgePDF no matter what I do.

Commands:

PS C:\windows\system32> Get-FTA .pdf
MSEdgePDF

PS C:\windows\system32> Remove-FTA MSEdgePDF .pdf
Removed: MSEdgePDF

PS C:\windows\system32> Get-FTA .pdf

PS C:\windows\system32> Set-FTA AcroExch.Document.DC .pdf

PS C:\windows\system32> Get-FTA .pdf
MSEdgePDF

PS C:\windows\system32>

What am I missing?

Danyfirex commented 2 years ago

Hello, are you sure you're importing the PS file before running the command?

wpltechstaff commented 2 years ago

Yes, I think if I tried without importing, I would get an error stating that Get-FTA / Set-FTA are unrecognized commands.

I have done some more troubleshooting:

& .\Set-FTA.ps1
Write-host "FTA is $(Get-FTA .pdf)"
Remove-FTA MSEdgePDF .pdf

Write-host "FTA is $(Get-FTA .pdf)"

Set-FTA AcroExch.Document.DC .pdf

Write-host "FTA at $(Get-Date) is $(Get-FTA .pdf)"; start-sleep -Milliseconds 100
Write-host "FTA at $(Get-Date) is $(Get-FTA .pdf)"; start-sleep -Milliseconds 100
Write-host "FTA at $(Get-Date) is $(Get-FTA .pdf)"; start-sleep -Milliseconds 100
Write-host "FTA at $(Get-Date) is $(Get-FTA .pdf)"; start-sleep -Milliseconds 100
Write-host "FTA at $(Get-Date) is $(Get-FTA .pdf)"; start-sleep -Milliseconds 100
Write-host "FTA at $(Get-Date) is $(Get-FTA .pdf)"; start-sleep -Milliseconds 100
Write-host "FTA at $(Get-Date) is $(Get-FTA .pdf)"; start-sleep -Milliseconds 100
Write-host "FTA at $(Get-Date) is $(Get-FTA .pdf)"; start-sleep -Milliseconds 100
Write-host "FTA at $(Get-Date) is $(Get-FTA .pdf)"; start-sleep -Milliseconds 100
Write-host "FTA at $(Get-Date) is $(Get-FTA .pdf)"; start-sleep -Milliseconds 100
Write-host "FTA at $(Get-Date) is $(Get-FTA .pdf)"; start-sleep -Milliseconds 100
Write-host "FTA at $(Get-Date) is $(Get-FTA .pdf)"; start-sleep -Milliseconds 100
Write-host "FTA at $(Get-Date) is $(Get-FTA .pdf)"; start-sleep -Milliseconds 100
Write-host "FTA at $(Get-Date) is $(Get-FTA .pdf)"; start-sleep -Milliseconds 100

Results in:

FTA is MSEdgePDF
Removed: MSEdgePDF
FTA is 
FTA at 04/11/2022 13:47:20 is AcroExch.Document.DC
FTA at 04/11/2022 13:47:20 is AcroExch.Document.DC
FTA at 04/11/2022 13:47:20 is AcroExch.Document.DC
FTA at 04/11/2022 13:47:20 is AcroExch.Document.DC
FTA at 04/11/2022 13:47:20 is AcroExch.Document.DC
FTA at 04/11/2022 13:47:21 is MSEdgePDF
FTA at 04/11/2022 13:47:21 is MSEdgePDF
FTA at 04/11/2022 13:47:21 is MSEdgePDF
FTA at 04/11/2022 13:47:21 is MSEdgePDF
FTA at 04/11/2022 13:47:21 is MSEdgePDF
FTA at 04/11/2022 13:47:21 is MSEdgePDF
FTA at 04/11/2022 13:47:21 is MSEdgePDF
FTA at 04/11/2022 13:47:21 is MSEdgePDF
FTA at 04/11/2022 13:47:21 is MSEdgePDF

So, it is being set, but nearly immediately being reverted back to MSEdgePDF. I confirmed that this happens when Edge is not running, both Edge update services are disabled, and all scheduled tasks are removed. I wonder what could be reverting this??

Danyfirex commented 2 years ago

Did you tried using -verbose? to get some debug information. I'm not sure what could be the issue. I've never got such issue.

wpltechstaff commented 2 years ago

Here it is with -verbose everywhere

VERBOSE: Get File Type Association for .pdf
FTA is MSEdgePDF
VERBOSE: Remove User UserChoice Key If Exist: Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.pdf\UserChoice
VERBOSE: Remove Key If Exist: HKCU:\SOFTWARE\Classes\MSEdgePDF
VERBOSE: Key No Exist: HKCU:\SOFTWARE\Classes\MSEdgePDF
VERBOSE: Remove Property If Exist: HKCU:\SOFTWARE\Classes\.pdf\OpenWithProgids Property MSEdgePDF
VERBOSE: Property No Exist: HKCU:\SOFTWARE\Classes\.pdf\OpenWithProgids Property: MSEdgePDF
Removed: MSEdgePDF
VERBOSE: Get File Type Association for .pdf
FTA is 
VERBOSE: ProgId: AcroExch.Document.DC
VERBOSE: Extension/Protocol: .pdf
VERBOSE: Getting Hash For AcroExch.Document.DC   .pdf
VERBOSE: baseInfo: .pdfs-1-5-21-1509256243-45632361-3638946562-500acroexch.document.dc01d84dce3da11c00user choice set via windows user
 experience {d18b6dd5-6124-4341-9318-804003bafa0b}
VERBOSE: Hash: ZHZx2cYtCF8=
VERBOSE: Write Registry Extension: .pdf
VERBOSE: Remove Extension UserChoice Key If Exist: Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.pdf\UserChoice
VERBOSE: Write Reg Extension UserChoice OK
VERBOSE: Get File Type Association for .pdf
FTA at 04/11/2022 14:02:00 is AcroExch.Document.DC
VERBOSE: Get File Type Association for .pdf
FTA at 04/11/2022 14:02:00 is AcroExch.Document.DC
VERBOSE: Get File Type Association for .pdf
FTA at 04/11/2022 14:02:00 is AcroExch.Document.DC
VERBOSE: Get File Type Association for .pdf
FTA at 04/11/2022 14:02:00 is AcroExch.Document.DC
VERBOSE: Get File Type Association for .pdf
FTA at 04/11/2022 14:02:00 is AcroExch.Document.DC
VERBOSE: Get File Type Association for .pdf
FTA at 04/11/2022 14:02:00 is MSEdgePDF
VERBOSE: Get File Type Association for .pdf
FTA at 04/11/2022 14:02:01 is MSEdgePDF
VERBOSE: Get File Type Association for .pdf
FTA at 04/11/2022 14:02:01 is MSEdgePDF
VERBOSE: Get File Type Association for .pdf
FTA at 04/11/2022 14:02:01 is MSEdgePDF
VERBOSE: Get File Type Association for .pdf
FTA at 04/11/2022 14:02:01 is MSEdgePDF
Danyfirex commented 2 years ago

I don't know what could be the issue. All seems to be correct. when you do it manually do you get it working correctly? I meant using OpenWith.exe?

wpltechstaff commented 2 years ago

Yes, if I change it in the UI (Right Click -> Properties -> Opens with) and choose Adobe Acrobat Reader, it sticks and works. And Get-FTA says AcroExch.Document.DC and stays. We're trying to deploy this to many computers so we need something that can be done programmatically in PS or CMD.

Danyfirex commented 2 years ago

I understand it's really werid the issue. Is there a possibility to get remote access to one of the machines to do some tests?

wpltechstaff commented 2 years ago

I am open to it. Do you have a tool in mind for this? We could maybe have a Zoom call and I could share my screen?

Danyfirex commented 2 years ago

Email me at hello.danysys@gmail.com so we can discuss further about it.

wpltechstaff commented 2 years ago

I was able to get the defaults to set and stick with SetUserFTA.exe. I am not sure exactly what it does differently from PS-SFTA, but it seems to work consistently to get Adobe Reader to open PDFs. I still blame Microsoft for making Edge so aggressive.

Danyfirex commented 2 years ago

If You still could give me remote access to one of the machines having the issue I could check SetUserFTA.exe and PS-SFTA and try to fix the issue.

Danyfirex commented 2 years ago

I'm closing this due to inactivity.