MSEndpointMgr / EDGEProfiles

PowerShell module to handle backup and restore of EDGE browser profiles for the current user.
MIT License
35 stars 8 forks source link

Backup of EdgeApps incomplete #4

Open htcfreek opened 3 years ago

htcfreek commented 3 years ago

You should additional backup the web app shortcuts in startmenu/desktop (current user) and the corresponding uninstall keys in regedit (hkcu) too.

If you don't do that users could get problems while removing them or adding them to start.

mardahl commented 3 years ago

Could you give some code examples? Thanks

htcfreek commented 3 years ago

I planned to upload an complete ps script. But it will take time. On wednesday I might get access to the working script.

But you can find the reg keys and shortcuts (user startmenu and user desktop) by the property of uninstall/destination path. It's edge_proxy.exe or something similar. For getting the shortcut destination you need the shell com object feature.

htcfreek commented 3 years ago

https://www.reddit.com/r/AskGreg/comments/2k0siw/powershell_get_shortcut_target/

mardahl commented 10 months ago

I can backup the PWA shortcuts with this bit of code:

#function to aquire the users PWA shortcuts from the userprofile
function Get-EdgePWAShortcuts{
    #Get all shortcuts from the userprofile and collect in array
    $Shortcuts = Get-ChildItem -ErrorAction SilentlyContinue -Recurse $($env:USERPROFILE) -Include *.lnk
    #Create shell object to analyse shortcut details
    $Shell = New-Object -ComObject WScript.Shell
    foreach ($Shortcut in $Shortcuts)
    {
        #Check if the shortcut is Edge based on the target path (this should be the PWA app)
        if ($Shell.CreateShortcut($Shortcut).targetpath -like "*edge_proxy.exe") {
            $Properties = @{
                ShortcutName = $Shortcut.Name;
                Path = $Shortcut.FullName;
                ShortcutDirectory = $shortcut.DirectoryName
                Target = $Shell.CreateShortcut($Shortcut).targetpath
            }
            #output the shortcut details as a PSObject
            New-Object PSObject -Property $Properties
        }
    }
    #Release the shell object
    [Runtime.InteropServices.Marshal]::ReleaseComObject($Shell) | Out-Null
}

But I don't see how it makes a difference without the registry, which I am not seeing any good docs on how to couple with the PWA shortcuts that have some references in : Computer\HKEY_CURRENT_USER\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppContainer\Mappings

Now I donøt use these PWA, so I won't be a good tester.

Could you perhaps suggest some more code logic if you want this feature added?

htcfreek commented 10 months ago

I can't help you with this. As some things have changed and my old solution doesn't work anymore, I have removed it.