Introduction

This PowerShell script sample shows how to copy the favorites to Windows 10 Edge browser.

 

Scenarios

Although Microsoft Edge supports users import favorites from IE or other browsers,  If users choose to do a fresh installation or get a new device with Windows 10 pre-installed, they needs to copy the bookmarks from old device into the Microsoft Edge manually.

This script will help users easily import favorites to Microsoft Edge. 

Script

Step 1: If you want to get a list of all cmdlet help topics, type the command Get-Help C:\Script\CopyFavoritesToEdgebrowser.ps1 –Full to display the entire help file for this function, such as the syntax, parameters, or examples. 

Step 2: To run the script sample, you can type the commands C:\Script\CopyFavoritesToEdgebrowser.ps1 -FavoritesPath D:\MyFavorites, this command shows how to copy the specified favorites to Edge browser. When the script finishes running, it will show the brief message.

As you can see, the specified favorites have been added in Edge browser.

Here are some code snippets for your references.

PowerShell
Edit|Remove
$EdgeFavoritesPath = "$env:LOCALAPPDATA\Packages\Microsoft.MicrosoftEdge_8wekyb3d8bbwe\AC\MicrosoftEdge\User\Default\Favorites"If(Test-Path-Path $FavoritesPath) 
{ 
    If($PSCmdlet.ShouldProcess("$EdgeFavoritesPath","Copy '$FavoritesPath'")) 
    { 
        Write-Verbose"Copying the favorites to Edge browser." 
        Copy-Item -Path $FavoritesPath-Recurse -Destination $EdgeFavoritesPath-ErrorAction SilentlyContinue 
    } 
     
    New-PSDrive-Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT |Out-Null$RegKeypPath = "HKCR:\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppContainer\Storage\microsoft.microsoftedge_8wekyb3d8bbwe\MicrosoftEdge\FavOrder"#Chechk if the Favorder registry key really exists.If(Test-Path-Path $RegKeypPath) 
    { 
        Write-Verbose"Deleting the FavOrder registry key."Remove-Item-Path $RegKeypPath-Recurse -ErrorAction SilentlyContinue -ErrorVariable RemoveError 
        If($RemoveError.Exception -eq $null) 
        { 
            Write-Host "Successfully copied the favorites to Edge browser." 
        } 
        Else 
        { 
            Write-Host "Failed to copied the favorites of Edge browser." 
        } 
    } 
    Else 
    { 
        Write-Host "Successfully copied the favorites to Edge browser." 
    } 
} 

Prerequisite

Windows PowerShell 2.0