|
| 1 | +# Description |
| 2 | +# This script will restore Windows Photo Viewer. |
| 3 | + |
| 4 | +Import-Module -DisableNameChecking $PSScriptRoot\..\lib\take-own.psm1 |
| 5 | + |
| 6 | +echo "Elevating priviledges for this process" |
| 7 | +do {} until (Elevate-Privileges SeTakeOwnershipPrivilege) |
| 8 | + |
| 9 | +New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT |
| 10 | + |
| 11 | +mkdir -Force "HKCR:\Applications\photoviewer.dll\shell\open\command" |
| 12 | +mkdir -Force "HKCR:\Applications\photoviewer.dll\shell\open\DropTarget" |
| 13 | + |
| 14 | +mkdir -Force "HKCR:\Applications\photoviewer.dll\shell\print\command" |
| 15 | +mkdir -Force "HKCR:\Applications\photoviewer.dll\shell\print\DropTarget" |
| 16 | + |
| 17 | +cmd /c regsvr32 /s "%ProgramFiles%\Windows Photo Viewer\PhotoViewer.dll" |
| 18 | + |
| 19 | +echo "Setting default Photo Viewer to Old Windows Photo Viewer" |
| 20 | +sp "HKCR:\Applications\photoviewer.dll\shell\open" "MuiVerb" "@photoviewer.dll,-3043" |
| 21 | + |
| 22 | +sp "HKCR:\Applications\photoviewer.dll\shell\open\command" '(default)' "%SystemRoot%\System32\rundll32.exe `"%ProgramFiles%\Windows Photo Viewer\PhotoViewer.dll`", ImageView_Fullscreen %1" -t e |
| 23 | + |
| 24 | +sp "HKCR:\Applications\photoviewer.dll\shell\open\DropTarget" "Clsid" "{FFE2A43C-56B9-4bf5-9A79-CC6D4285608A}" |
| 25 | + |
| 26 | +sp "HKCR:\Applications\photoviewer.dll\shell\print\command" '(default)' "%SystemRoot%\System32\rundll32.exe `"%ProgramFiles%\Windows Photo Viewer\PhotoViewer.dll`", ImageView_Fullscreen %1" -t e |
| 27 | + |
| 28 | +sp "HKCR:\Applications\photoviewer.dll\shell\print\DropTarget]" "Clsid" "{60fd46de-f830-4894-a628-6fa81bc0190d}" |
| 29 | + |
| 30 | +echo "Set default association for Photo Viewer" |
| 31 | +# cmd /c assoc /? |
| 32 | +# cmd /c ftype /? |
| 33 | + |
| 34 | +mkdir -Force "HKCR:\PhotoViewer.FileAssoc.Bitmap\DefaultIcon" |
| 35 | +mkdir -Force "HKCR:\PhotoViewer.FileAssoc.Bitmap\shell\open\command" |
| 36 | +mkdir -Force "HKCR:\PhotoViewer.FileAssoc.Bitmap\shell\open\DropTarget" |
| 37 | +sp "HKCR:\PhotoViewer.FileAssoc.Bitmap" "ImageOptionFlags" 1 -t d |
| 38 | +sp "HKCR:\PhotoViewer.FileAssoc.Bitmap" "FriendlyTypeName" "@%ProgramFiles%\Windows Photo Viewer\PhotoViewer.dll,-3056" -t e |
| 39 | +sp "HKCR:\PhotoViewer.FileAssoc.Bitmap\DefaultIcon" '(default)' "%SystemRoot%\System32\imageres.dll,-70" |
| 40 | +sp "HKCR:\PhotoViewer.FileAssoc.Bitmap\shell\open\command" '(default)' "%SystemRoot%\System32\rundll32.exe `"%ProgramFiles%\Windows Photo Viewer\PhotoViewer.dll`", ImageView_Fullscreen %1" -t e |
| 41 | +sp "HKCR:\PhotoViewer.FileAssoc.Bitmap\shell\open\DropTarget" "Clsid" "{FFE2A43C-56B9-4bf5-9A79-CC6D4285608A}" |
| 42 | + |
| 43 | +mkdir -Force "HKCR:\PhotoViewer.FileAssoc.JFIF\DefaultIcon" |
| 44 | +mkdir -Force "HKCR:\PhotoViewer.FileAssoc.JFIF\shell\open\command" |
| 45 | +mkdir -Force "HKCR:\PhotoViewer.FileAssoc.JFIF\shell\open\DropTarget" |
| 46 | +sp "HKCR:\PhotoViewer.FileAssoc.JFIF" "EditFlags" 0x10000 -t d |
| 47 | +sp "HKCR:\PhotoViewer.FileAssoc.JFIF" "ImageOptionFlags" 1 -t d |
| 48 | +sp "HKCR:\PhotoViewer.FileAssoc.JFIF" "FriendlyTypeName" "@%ProgramFiles%\Windows Photo Viewer\PhotoViewer.dll,-3055" -t e |
| 49 | +sp "HKCR:\PhotoViewer.FileAssoc.JFIF\DefaultIcon" '(default)' "%SystemRoot%\System32\imageres.dll,-72" |
| 50 | +sp "HKCR:\PhotoViewer.FileAssoc.JFIF\shell\open" "MuiVerb" "@%ProgramFiles%\Windows Photo Viewer\photoviewer.dll,-3043" -t e |
| 51 | +sp "HKCR:\PhotoViewer.FileAssoc.JFIF\shell\open\command" '(default)' "%SystemRoot%\System32\rundll32.exe `"%ProgramFiles%\Windows Photo Viewer\PhotoViewer.dll`", ImageView_Fullscreen %1" -t e |
| 52 | +sp "HKCR:\PhotoViewer.FileAssoc.JFIF\shell\open\DropTarget" "Clsid" "{FFE2A43C-56B9-4bf5-9A79-CC6D4285608A}" |
| 53 | + |
| 54 | +mkdir -Force "HKCR:\PhotoViewer.FileAssoc.Jpeg\DefaultIcon" |
| 55 | +mkdir -Force "HKCR:\PhotoViewer.FileAssoc.Jpeg\shell\open\command" |
| 56 | +mkdir -Force "HKCR:\PhotoViewer.FileAssoc.Jpeg\shell\open\DropTarget" |
| 57 | +sp "HKCR:\PhotoViewer.FileAssoc.Jpeg" "EditFlags" 0x10000 -t d |
| 58 | +sp "HKCR:\PhotoViewer.FileAssoc.Jpeg" "ImageOptionFlags" 1 -t d |
| 59 | +sp "HKCR:\PhotoViewer.FileAssoc.Jpeg" "FriendlyTypeName" "@%ProgramFiles%\Windows Photo Viewer\PhotoViewer.dll,-3055" -t e |
| 60 | +sp "HKCR:\PhotoViewer.FileAssoc.Jpeg\DefaultIcon" '(default)' "%SystemRoot%\System32\imageres.dll,-72" |
| 61 | +sp "HKCR:\PhotoViewer.FileAssoc.Jpeg\shell\open" "MuiVerb" "@%ProgramFiles%\Windows Photo Viewer\photoviewer.dll,-3043" -t e |
| 62 | +sp "HKCR:\PhotoViewer.FileAssoc.Jpeg\shell\open\command" '(default)' "%SystemRoot%\System32\rundll32.exe `"%ProgramFiles%\Windows Photo Viewer\PhotoViewer.dll`", ImageView_Fullscreen %1" -t e |
| 63 | +sp "HKCR:\PhotoViewer.FileAssoc.Jpeg\shell\open\DropTarget" "Clsid" "{FFE2A43C-56B9-4bf5-9A79-CC6D4285608A}" |
| 64 | + |
| 65 | +mkdir -Force "HKCR:\PhotoViewer.FileAssoc.Gif\DefaultIcon" |
| 66 | +mkdir -Force "HKCR:\PhotoViewer.FileAssoc.Gif\shell\open\command" |
| 67 | +mkdir -Force "HKCR:\PhotoViewer.FileAssoc.Gif\shell\open\DropTarget" |
| 68 | +sp "HKCR:\PhotoViewer.FileAssoc.Gif" "ImageOptionFlags" 1 -t d |
| 69 | +sp "HKCR:\PhotoViewer.FileAssoc.Gif" "FriendlyTypeName" "@%ProgramFiles%\Windows Photo Viewer\PhotoViewer.dll,-3057" -t e |
| 70 | +sp "HKCR:\PhotoViewer.FileAssoc.Gif\DefaultIcon" '(default)' "%SystemRoot%\System32\imageres.dll,-83" |
| 71 | +sp "HKCR:\PhotoViewer.FileAssoc.Gif\shell\open\command" '(default)' "%SystemRoot%\System32\rundll32.exe `"%ProgramFiles%\Windows Photo Viewer\PhotoViewer.dll`", ImageView_Fullscreen %1" -t e |
| 72 | +sp "HKCR:\PhotoViewer.FileAssoc.Gif\shell\open\DropTarget" "Clsid" "{FFE2A43C-56B9-4bf5-9A79-CC6D4285608A}" |
| 73 | + |
| 74 | +mkdir -Force "HKCR:\PhotoViewer.FileAssoc.Png\DefaultIcon" |
| 75 | +mkdir -Force "HKCR:\PhotoViewer.FileAssoc.Png\shell\open\command" |
| 76 | +mkdir -Force "HKCR:\PhotoViewer.FileAssoc.Png\shell\open\DropTarget" |
| 77 | +sp "HKCR:\PhotoViewer.FileAssoc.Png" "ImageOptionFlags" 1 -t d |
| 78 | +sp "HKCR:\PhotoViewer.FileAssoc.Png" "FriendlyTypeName" "@%ProgramFiles%\Windows Photo Viewer\PhotoViewer.dll,-3057" -t e |
| 79 | +sp "HKCR:\PhotoViewer.FileAssoc.Png\DefaultIcon" '(default)' "%SystemRoot%\System32\imageres.dll,-71" |
| 80 | +sp "HKCR:\PhotoViewer.FileAssoc.Png\shell\open\command" '(default)' "%SystemRoot%\System32\rundll32.exe `"%ProgramFiles%\Windows Photo Viewer\PhotoViewer.dll`", ImageView_Fullscreen %1" -t e |
| 81 | +sp "HKCR:\PhotoViewer.FileAssoc.Png\shell\open\DropTarget" "Clsid" "{FFE2A43C-56B9-4bf5-9A79-CC6D4285608A}" |
| 82 | + |
| 83 | +mkdir -Force "HKCR:\PhotoViewer.FileAssoc.Wdp\DefaultIcon" |
| 84 | +mkdir -Force "HKCR:\PhotoViewer.FileAssoc.Wdp\shell\open\command" |
| 85 | +mkdir -Force "HKCR:\PhotoViewer.FileAssoc.Wdp\shell\open\DropTarget" |
| 86 | +sp "HKCR:\PhotoViewer.FileAssoc.Wdp" "EditFlags" 0x10000 -t d |
| 87 | +sp "HKCR:\PhotoViewer.FileAssoc.Wdp" "ImageOptionFlags" 1 -t d |
| 88 | +sp "HKCR:\PhotoViewer.FileAssoc.Wdp\DefaultIcon" '(default)' "%SystemRoot%\System32\imageres.dll,-400" |
| 89 | +sp "HKCR:\PhotoViewer.FileAssoc.Wdp\shell\open" "MuiVerb" "@%ProgramFiles%\Windows Photo Viewer\photoviewer.dll,-3043" -t e |
| 90 | +sp "HKCR:\PhotoViewer.FileAssoc.Wdp\shell\open\command" '(default)' "%SystemRoot%\System32\rundll32.exe `"%ProgramFiles%\Windows Photo Viewer\PhotoViewer.dll`", ImageView_Fullscreen %1" -t e |
| 91 | +sp "HKCR:\PhotoViewer.FileAssoc.Wdp\shell\open\DropTarget" "Clsid" "{FFE2A43C-56B9-4bf5-9A79-CC6D4285608A}" |
| 92 | + |
| 93 | +mkdir -Force "HKLM:\SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" |
| 94 | +sp "HKLM:\SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities" "ApplicationDescription" "@%ProgramFiles%\\Windows Photo Viewer\\photoviewer.dll,-3069" |
| 95 | +sp "HKLM:\SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities" "ApplicationName" "@%ProgramFiles%\\Windows Photo Viewer\\photoviewer.dll,-3009" |
| 96 | +sp "HKLM:\SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" ".jpg" "PhotoViewer.FileAssoc.Jpeg" |
| 97 | +sp "HKLM:\SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" ".wdp" "PhotoViewer.FileAssoc.Wdp" |
| 98 | +sp "HKLM:\SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" ".jfif" "PhotoViewer.FileAssoc.JFIF" |
| 99 | +sp "HKLM:\SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" ".dib" "PhotoViewer.FileAssoc.Bitmap" |
| 100 | +sp "HKLM:\SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" ".png" "PhotoViewer.FileAssoc.Png" |
| 101 | +sp "HKLM:\SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" ".jxr" "PhotoViewer.FileAssoc.Wdp" |
| 102 | +sp "HKLM:\SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" ".bmp" "PhotoViewer.FileAssoc.Bitmap" |
| 103 | +sp "HKLM:\SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" ".jpe" "PhotoViewer.FileAssoc.Jpeg" |
| 104 | +sp "HKLM:\SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" ".jpeg" "PhotoViewer.FileAssoc.Jpeg" |
| 105 | +sp "HKLM:\SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" ".gif" "PhotoViewer.FileAssoc.Gif" |
0 commit comments