cloudnoob
Goto Top

PS Skript MS Edge Favoriten

Hallo liebe Gemeinde,

ich bastle grad an einem Powershell Skript rum und komme nicht wirklich weiter.

Ziel des Skriptes ist es per PS Favoriten in den MS Edge Browser hinzuzufügen.
GPOs können/dürfen nicht verwendet werden.

# Create Edge browser favorites folder
$edgeFolderPath = "$env:LOCALAPPDATA\Microsoft\Edge\User Data\Default"  
$favoritesPath = Join-Path $edgeFolderPath "Favorites"  
$bliblablubFolder = Join-Path $favoritesPath "BliBlaBlub"  
if (!(Test-Path $bliblablubFolder -PathType Container)) {
    New-Item $bliblablubFolder -ItemType Directory
}

# Add favorite links to bliblablub folder
$favorites = @(
    @{
        url = "https://bliblabub"  
        name = "bliblabub"  
    },
    @{
        url = "https://bliblabub"  
        name = "bliblabub"  
    },
    @{
        url = "https://bliblabub"  
        name = "bliblabub"  
    },
    @{
        url = "https://bliblabub"  
        name = "bliblabub"  
    },
    @{
        url = "https://bliblabub"  
        name = "bliblabub"  
    },
    @{
        url = "https://bliblabub"  
        name = "bliblabub"  
    },
    @{
        url = "https://bliblabub"  
        name = "bliblabub"  
    },
    @{
        url = "https://bliblabub"  
        name = "bliblabub"  
    },
    @{
        url = "https://bliblabub"  
        name = "bliblabub"  
    },
    @{
        url = "https://bliblabub"  
        name = "bliblabub"  
    },
    @{
        url = "https://bliblabub"  
        name = "bliblabub"  
    },
    @{
        url = "https://bliblabub"  
        name = "bliblabub"  
    },
    @{
        url = "https://bliblabub"  
        name = "bliblabub"  
    }
)

foreach ($favorite in $favorites) {
    $url = $favorite.url
    $name = $favorite.name
    $linkPath = Join-Path $bliblablubFolder "$name.url"  
    $shortcutPath = Join-Path $bliblablubFolder "$name.lnk"  
    if (!(Test-Path $linkPath) -and !(Test-Path $shortcutPath)) {
        New-Item $linkPath -ItemType File -Force | Out-Null
        $shell = New-Object -ComObject WScript.Shell
        $shortcut = $shell.CreateShortcut($shortcutPath)
        $shortcut.TargetPath = $url
        $shortcut.Save()
    }
}


Wird das Skript ausgeführt werden die Links im Ordner
C:\Users\username\AppData\Local\Microsoft\Edge\User Data\Default\Favorites\ordnername
auch angezeigt.
Allerdings im Browser nicht.
Skript wurde mit Adminrechten ausgeführt.
Windows wurde ebenfalls neu gestartet.

Hat jemand eine Idee wo mein Fehler liegen könnte?

Danke schonmal im voraus.

Content-Key: 6934910855

Url: https://administrator.de/contentid/6934910855

Printed on: April 28, 2024 at 09:04 o'clock

Mitglied: 3063370895
Solution 3063370895 Apr 27, 2023 updated at 11:18:45 (UTC)
Goto Top
Hi,

Edge speichert die Favoriten alle in der Datei "Bookmarks" unter
%LocalAppData%\Microsoft\Edge\User Data\Default
Das ist eine JSON-Datei, da kannst du die Bookmarks reinkopieren.
Alternativ erstell dir eine Musterdatei auf deinem Rechner und verteile die dann.
-Thomas
Member: Doskias
Solution Doskias Apr 27, 2023 at 11:16:45 (UTC)
Goto Top
Moin,

schau dir mal im User Data/Defaults-Ordner die Datei Bookmarks an. Da steht drin, was der Edge anzeigen soll. Soweit ich sehe, passt du diese nicht an, daher seihst u nichts.

Gruß
Doskias
Member: Cloudnoob
Cloudnoob Apr 27, 2023 at 11:35:27 (UTC)
Goto Top
Ich danke euch klappt prima face-smile