{"id":377907,"date":"2024-10-31T10:37:07","date_gmt":"2024-10-31T10:37:07","guid":{"rendered":"https:\/\/www.ninjaone.com\/?post_type=script_hub&#038;p=377907"},"modified":"2024-10-31T10:37:07","modified_gmt":"2024-10-31T10:37:07","slug":"browser-erweiterungen-mit-powershell-auflisten","status":"publish","type":"script_hub","link":"https:\/\/www.ninjaone.com\/de\/script-hub\/browser-erweiterungen-mit-powershell-auflisten\/","title":{"rendered":"Wie man alle Browser-Erweiterungen unter Windows mit PowerShell auflistet"},"content":{"rendered":"<p>Die Verwaltung von Browser-Erweiterungen f\u00fcr mehrere Benutzer:innen und Systeme ist eine h\u00e4ufige Herausforderung im IT-Management. Browser-Erweiterungen sind zwar n\u00fctzlich, k\u00f6nnen aber auch ein erhebliches Sicherheitsrisiko darstellen, wenn sie nicht richtig \u00fcberwacht werden. Sie k\u00f6nnen Schwachstellen einf\u00fchren, Benutzeraktivit\u00e4ten ausspionieren oder zu Einstiegspunkten f\u00fcr <a href=\"https:\/\/www.ninjaone.com\/de\/blog\/5-schritte-zur-entfernung-von-malware-von-ihrem-computer\/\" target=\"_blank\" rel=\"noopener\">Malware<\/a> werden. Um sie gr\u00fcndlich zu \u00fcberwachen, sehen Sie sich in unserem Blogbeitrag an, wie sie Browser-Erweiterungen mit PowerShell auflisten k\u00f6nnen.<\/p>\n<p>Dieses Skript bietet eine robuste L\u00f6sung f\u00fcr IT-Experten und <a href=\"https:\/\/www.ninjaone.com\/de\/was-ist-ein-msp\" target=\"_blank\" rel=\"noopener\">Managed Service Provider (MSPs)<\/a> <strong>zur Inventarisierung installierter Browser-Erweiterungen in g\u00e4ngigen Browsern<\/strong> wie Chrome, Firefox und Edge.<\/p>\n<h2>Kontext<\/h2>\n<p>Da Unternehmen zunehmend auf webbasierte Anwendungen zur\u00fcckgreifen, spielen Browser-Erweiterungen eine immer gr\u00f6\u00dfere Rolle. Dies erh\u00f6ht jedoch auch die Notwendigkeit der \u00dcberwachung, um zu gew\u00e4hrleisten, dass die Erweiterungen sicher sind und mit den Unternehmensrichtlinien \u00fcbereinstimmen. Dieses Skript erf\u00fcllt diese Anforderungen, indem es einen umfassenden Bericht \u00fcber alle installierten Browser-Erweiterungen f\u00fcr die wichtigsten Browser bereitstellt, was es zu einem unverzichtbaren Tool f\u00fcr IT-Experten und MSPs macht, die f\u00fcr Sicherheit und Compliance sorgen m\u00fcssen.<\/p>\n<h2>Das Skript<\/h2>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"powershell\">#Requires -Version 5.1\r\n\r\n&lt;#\r\n.SYNOPSIS\r\n    Reports on all installed browser extensions for Chrome, Firefox and Edge.\r\n.DESCRIPTION\r\n    Reports on all installed browser extensions for Chrome, Firefox and Edge.\r\n.EXAMPLE\r\n    (No Parameters)\r\n\r\n    A Google Chrome installation was detected. Searching Chrome for browser extensions...\r\n    A Microsoft Edge installation was detected. Searching Microsoft Edge for browser extensions...\r\n    A Firefox installation was detected. Searching Firefox for browser extensions...\r\n    Attempting to set Custom Field 'Multiline'.\r\n    WARNING: 10,000 Character Limit has been reached! Trimming output until the character limit is satisfied...\r\n    Successfully set Custom Field 'Multiline'!\r\n    Attempting to set Custom Field 'WYSIWYG'.\r\n    Successfully set Custom Field 'WYSIWYG'!\r\n    Browser extensions were detected.\r\n\r\n\r\n    Browser      : Chrome\r\n    User         : cheart\r\n    Name         : askBelynda | Sustainable Shopping\r\n    Extension ID : pcmbjnfbjkeieekkahdfgchcbjfhhgdi\r\n    Description  : Sustainable shopping made simple with askBelynda. Choose ethical products o(...)\r\n\r\n    Browser      : Chrome\r\n    User         : cheart\r\n    Name         : Beni - Your secondhand shopping assistant\r\n    Extension ID : efdgbhncnligcbloejoaemnfhjihkccj\r\n    Description  : The easiest way to shop secondhand.  Beni finds the best resale alternative(...)\r\n\r\n    Browser      : Chrome\r\n    User         : cheart\r\n    Name         : Bonjourr \u00c3\u201a\u00c2\u00b7 Minimalist Startpage\r\n    Extension ID : dlnejlppicbjfcfcedcflplfjajinajd\r\n    Description  : Improve your web browsing experience with Bonjourr, a beautiful, customizab(...)\r\n\r\n    Browser      : Chrome\r\n    User         : cheart\r\n    Name         : Boxel 3D\r\n    Extension ID : mjjgmlmpeaikcaajghilhnioimmaibon\r\n    Description  : Boxel 3D is the 3rd release of your favorite box jumping game made by the d(...)\r\n\r\n    ...\r\n\r\nPARAMETER: -MultilineCustomField \"ReplaceMeWithNameOfAMultilineCustomField\"\r\n    Specify the name of a multiline custom field to optionally store the search results in. Leave blank to not set a multiline field.\r\n\r\nPARAMETER: -WysiwygCustomField \"ReplaceMeWithAnyWYSIWYGCustomField\"\r\n    Specify the name of a WYSIWYG custom field to optionally store the search results in. Leave blank to not set a WYSIWYG field.\r\n\r\n.NOTES\r\n    Minimum OS Architecture Supported: Windows 10, Windows Server 2016\r\n    Release Notes: Initial Release\r\nBy using this script, you indicate your acceptance of the following legal terms as well as our Terms of Use at https:\/\/www.ninjaone.com\/terms-of-use.\r\n    Ownership Rights: NinjaOne owns and will continue to own all right, title, and interest in and to the script (including the copyright). NinjaOne is giving you a limited license to use the script in accordance with these legal terms. \r\n    Use Limitation: You may only use the script for your legitimate personal or internal business purposes, and you may not share the script with another party. \r\n    Republication Prohibition: Under no circumstances are you permitted to re-publish the script in any script library or website belonging to or under the control of any other software provider. \r\n    Warranty Disclaimer: The script is provided \u201cas is\u201d and \u201cas available\u201d, without warranty of any kind. NinjaOne makes no promise or guarantee that the script will be free from defects or that it will meet your specific needs or expectations. \r\n    Assumption of Risk: Your use of the script is at your own risk. You acknowledge that there are certain inherent risks in using the script, and you understand and assume each of those risks. \r\n    Waiver and Release: You will not hold NinjaOne responsible for any adverse or unintended consequences resulting from your use of the script, and you waive any legal or equitable rights or remedies you may have against NinjaOne relating to your use of the script. \r\n    EULA: If you are a NinjaOne customer, your use of the script is subject to the End User License Agreement applicable to you (EULA).\r\n#&gt;\r\n\r\n[CmdletBinding()]\r\nparam (\r\n    [Parameter()]\r\n    [String]$MultilineCustomField,\r\n    [Parameter()]\r\n    [String]$WysiwygCustomField\r\n)\r\n\r\nbegin {\r\n    # Replace parameters with the dynamic script variables.\r\n    if ($env:multilineCustomFieldName -and $env:multilineCustomFieldName -notlike \"null\") { $MultilineCustomField = $env:multilineCustomFieldName }\r\n    if ($env:wysiwygCustomFieldName -and $env:wysiwygCustomFieldName -notlike \"null\") { $WysiwygCustomField = $env:wysiwygCustomFieldName }\r\n\r\n    # Check if $MultilineCustomField and $WysiwygCustomField are both not null and have the same value\r\n    if ($MultilineCustomField -and $WysiwygCustomField -and $MultilineCustomField -eq $WysiwygCustomField) {\r\n        Write-Host \"[Error] Custom Fields of different types cannot have the same name.\"\r\n        Write-Host \"https:\/\/ninjarmm.zendesk.com\/hc\/en-us\/articles\/360060920631-Custom-Fields-Configuration-Device-Role-Fields\"\r\n        exit 1\r\n    }\r\n\r\n    # Function to get user registry hives based on the type of account\r\n    function Get-UserHives {\r\n        param (\r\n            [Parameter()]\r\n            [ValidateSet('AzureAD', 'DomainAndLocal', 'All')]\r\n            [String]$Type = \"All\",\r\n            [Parameter()]\r\n            [String[]]$ExcludedUsers,\r\n            [Parameter()]\r\n            [switch]$IncludeDefault\r\n        )\r\n    \r\n        # Patterns for user SID depending on account type\r\n        $Patterns = switch ($Type) {\r\n            \"AzureAD\" { \"S-1-12-1-(\\d+-?){4}$\" }\r\n            \"DomainAndLocal\" { \"S-1-5-21-(\\d+-?){4}$\" }\r\n            \"All\" { \"S-1-12-1-(\\d+-?){4}$\" ; \"S-1-5-21-(\\d+-?){4}$\" } \r\n        }\r\n    \r\n        # Fetch user profiles whose SIDs match the defined patterns and prepare objects with their details\r\n        $UserProfiles = Foreach ($Pattern in $Patterns) { \r\n            Get-ItemProperty \"HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList\\*\" |\r\n                Where-Object { $_.PSChildName -match $Pattern } | \r\n                Select-Object @{Name = \"SID\"; Expression = { $_.PSChildName } },\r\n                @{Name = \"UserName\"; Expression = { \"$($_.ProfileImagePath | Split-Path -Leaf)\" } }, \r\n                @{Name = \"UserHive\"; Expression = { \"$($_.ProfileImagePath)\\NTuser.dat\" } }, \r\n                @{Name = \"Path\"; Expression = { $_.ProfileImagePath } }\r\n        }\r\n    \r\n        # Handle inclusion of the default user profile if requested\r\n        switch ($IncludeDefault) {\r\n            $True {\r\n                $DefaultProfile = \"\" | Select-Object UserName, SID, UserHive, Path\r\n                $DefaultProfile.UserName = \"Default\"\r\n                $DefaultProfile.SID = \"DefaultProfile\"\r\n                $DefaultProfile.Userhive = \"$env:SystemDrive\\Users\\Default\\NTUSER.DAT\"\r\n                $DefaultProfile.Path = \"C:\\Users\\Default\"\r\n    \r\n                $DefaultProfile | Where-Object { $ExcludedUsers -notcontains $_.UserName }\r\n            }\r\n        }\r\n\r\n        # Return user profiles, excluding any specified users\r\n        $UserProfiles | Where-Object { $ExcludedUsers -notcontains $_.UserName }\r\n    }\r\n\r\n    # Function to check if the current PowerShell session is running with elevated permissions\r\n    function Test-IsElevated {\r\n        $id = [System.Security.Principal.WindowsIdentity]::GetCurrent()\r\n        $p = New-Object System.Security.Principal.WindowsPrincipal($id)\r\n        $p.IsInRole([System.Security.Principal.WindowsBuiltInRole]::Administrator)\r\n    }\r\n\r\n    function Set-NinjaProperty {\r\n        [CmdletBinding()]\r\n        Param(\r\n            [Parameter(Mandatory = $True)]\r\n            [String]$Name,\r\n            [Parameter()]\r\n            [String]$Type,\r\n            [Parameter(Mandatory = $True, ValueFromPipeline = $True)]\r\n            $Value,\r\n            [Parameter()]\r\n            [String]$DocumentName\r\n        )\r\n    \r\n        $Characters = $Value | Out-String | Measure-Object -Character | Select-Object -ExpandProperty Characters\r\n        if ($Characters -ge 200000) {\r\n            throw [System.ArgumentOutOfRangeException]::New(\"Character limit exceeded; the value is greater than or equal to 200,000 characters.\")\r\n        }\r\n        \r\n        # If requested to set the field value for a Ninja document, we'll specify it here.\r\n        $DocumentationParams = @{}\r\n        if ($DocumentName) { $DocumentationParams[\"DocumentName\"] = $DocumentName }\r\n        \r\n        # This is a list of valid fields that can be set. If no type is specified, it is assumed that the input does not need to be changed.\r\n        $ValidFields = \"Attachment\", \"Checkbox\", \"Date\", \"Date or Date Time\", \"Decimal\", \"Dropdown\", \"Email\", \"Integer\", \"IP Address\", \"MultiLine\", \"MultiSelect\", \"Phone\", \"Secure\", \"Text\", \"Time\", \"URL\", \"WYSIWYG\"\r\n        if ($Type -and $ValidFields -notcontains $Type) { Write-Warning \"$Type is an invalid type! Please check here for valid types: https:\/\/ninjarmm.zendesk.com\/hc\/en-us\/articles\/16973443979789-Command-Line-Interface-CLI-Supported-Fields-and-Functionality\" }\r\n        \r\n        # The field below requires additional information to be set.\r\n        $NeedsOptions = \"Dropdown\"\r\n        if ($DocumentName) {\r\n            if ($NeedsOptions -contains $Type) {\r\n                # Redirect error output to the success stream to make it easier to handle errors if nothing is found or if something else goes wrong.\r\n                $NinjaPropertyOptions = Ninja-Property-Docs-Options -AttributeName $Name @DocumentationParams 2&gt;&amp;1\r\n            }\r\n        }\r\n        else {\r\n            if ($NeedsOptions -contains $Type) {\r\n                $NinjaPropertyOptions = Ninja-Property-Options -Name $Name 2&gt;&amp;1\r\n            }\r\n        }\r\n        \r\n        # If an error is received with an exception property, the function will exit with that error information.\r\n        if ($NinjaPropertyOptions.Exception) { throw $NinjaPropertyOptions }\r\n        \r\n        # The below types require values not typically given in order to be set. The below code will convert whatever we're given into a format ninjarmm-cli supports.\r\n        switch ($Type) {\r\n            \"Checkbox\" {\r\n                # Although it's highly likely we were given a value like \"True\" or a boolean datatype, it's better to be safe than sorry.\r\n                $NinjaValue = [System.Convert]::ToBoolean($Value)\r\n            }\r\n            \"Date or Date Time\" {\r\n                # Ninjarmm-cli expects the GUID of the option to be selected. Therefore, the given value will be matched with a GUID.\r\n                $Date = (Get-Date $Value).ToUniversalTime()\r\n                $TimeSpan = New-TimeSpan (Get-Date \"1970-01-01 00:00:00\") $Date\r\n                $NinjaValue = $TimeSpan.TotalSeconds\r\n            }\r\n            \"Dropdown\" {\r\n                # Ninjarmm-cli is expecting the guid of the option we're trying to select. So we'll match up the value we were given with a guid.\r\n                $Options = $NinjaPropertyOptions -replace '=', ',' | ConvertFrom-Csv -Header \"GUID\", \"Name\"\r\n                $Selection = $Options | Where-Object { $_.Name -eq $Value } | Select-Object -ExpandProperty GUID\r\n        \r\n                if (-not $Selection) {\r\n                    throw [System.ArgumentOutOfRangeException]::New(\"Value is not present in dropdown options.\")\r\n                }\r\n        \r\n                $NinjaValue = $Selection\r\n            }\r\n            default {\r\n                # All the other types shouldn't require additional work on the input.\r\n                $NinjaValue = $Value\r\n            }\r\n        }\r\n        \r\n        # We'll need to set the field differently depending on if its a field in a Ninja Document or not.\r\n        if ($DocumentName) {\r\n            $CustomField = Ninja-Property-Docs-Set -AttributeName $Name -AttributeValue $NinjaValue @DocumentationParams 2&gt;&amp;1\r\n        }\r\n        else {\r\n            $CustomField = $NinjaValue | Ninja-Property-Set-Piped -Name $Name 2&gt;&amp;1\r\n        }\r\n        \r\n        if ($CustomField.Exception) {\r\n            throw $CustomField\r\n        }\r\n    }\r\n\r\n    # Function to find installation keys based on the display name, optionally returning uninstall strings\r\n    function Find-InstallKey {\r\n        [CmdletBinding()]\r\n        param (\r\n            [Parameter(ValueFromPipeline = $True)]\r\n            [String]$DisplayName,\r\n            [Parameter()]\r\n            [Switch]$UninstallString,\r\n            [Parameter()]\r\n            [String]$UserBaseKey\r\n        )\r\n        process {\r\n            # Initialize an empty list to hold installation objects\r\n            $InstallList = New-Object System.Collections.Generic.List[Object]\r\n\r\n            # If no user base key is specified, search in the default system-wide uninstall paths\r\n            if (!$UserBaseKey) {\r\n                # Search for programs in 32-bit and 64-bit locations. Then add them to the list if they match the display name\r\n                $Result = Get-ChildItem -Path \"HKLM:\\Software\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\*\" | Get-ItemProperty | Where-Object { $_.DisplayName -like \"*$DisplayName*\" }\r\n                if ($Result) { $InstallList.Add($Result) }\r\n\r\n                $Result = Get-ChildItem -Path \"HKLM:\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\*\" | Get-ItemProperty | Where-Object { $_.DisplayName -like \"*$DisplayName*\" }\r\n                if ($Result) { $InstallList.Add($Result) }\r\n            }\r\n            else {\r\n                # If a user base key is specified, search in the user-specified 64-bit and 32-bit paths.\r\n                $Result = Get-ChildItem -Path \"$UserBaseKey\\Software\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\*\" | Get-ItemProperty | Where-Object { $_.DisplayName -like \"*$DisplayName*\" }\r\n                if ($Result) { $InstallList.Add($Result) }\r\n    \r\n                $Result = Get-ChildItem -Path \"$UserBaseKey\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\*\" | Get-ItemProperty | Where-Object { $_.DisplayName -like \"*$DisplayName*\" }\r\n                if ($Result) { $InstallList.Add($Result) }\r\n            }\r\n    \r\n            # If the UninstallString switch is specified, return only the uninstall strings; otherwise, return the full installation objects.\r\n            if ($UninstallString) {\r\n                $InstallList | Select-Object -ExpandProperty UninstallString -ErrorAction SilentlyContinue\r\n            }\r\n            else {\r\n                $InstallList\r\n            }\r\n        }\r\n    }\r\n\r\n    if (!$ExitCode) {\r\n        $ExitCode = 0\r\n    }\r\n}\r\nprocess {\r\n    # Check if the script is running with elevated permissions (administrator rights)\r\n    if (!(Test-IsElevated)) {\r\n        Write-Host -Object \"[Error] Access Denied. Please run with Administrator privileges.\"\r\n        exit 1\r\n    }\r\n\r\n    # Search for Chrome installations on the system and enable chrome extension search if found.\r\n    Find-InstallKey -DisplayName \"Chrome\" | ForEach-Object {\r\n        $ChromeInstallations = $True\r\n    }\r\n\r\n    # Search for Firefox installations on the system and enable firefox extension search if found.\r\n    Find-InstallKey -DisplayName \"Firefox\" | ForEach-Object {\r\n        $FireFoxInstallations = $True\r\n    }\r\n\r\n    # Search for Edge installations on the system and flag if found and enable edge extension search if found.\r\n    Find-InstallKey -DisplayName \"Edge\" | ForEach-Object {  \r\n        $EdgeInstallations = $True\r\n    }\r\n\r\n    # Retrieve all user profiles from the system\r\n    $UserProfiles = Get-UserHives -Type \"All\"\r\n    # Loop through each profile on the machine\r\n    Foreach ($UserProfile in $UserProfiles) {\r\n        # Load User ntuser.dat if it's not already loaded\r\n        If (($ProfileWasLoaded = Test-Path Registry::HKEY_USERS\\$($UserProfile.SID)) -eq $false) {\r\n            Start-Process -FilePath \"cmd.exe\" -ArgumentList \"\/C reg.exe LOAD HKU\\$($UserProfile.SID) `\"$($UserProfile.UserHive)`\"\" -Wait -WindowStyle Hidden\r\n        }\r\n\r\n        # Repeat search for installations of browsers but in the user's registry context\r\n        Find-InstallKey -UserBaseKey \"Registry::HKEY_USERS\\$($UserProfile.SID)\" -DisplayName \"Chrome\" | ForEach-Object { \r\n            $ChromeInstallations = $True\r\n        }\r\n        Find-InstallKey -UserBaseKey \"Registry::HKEY_USERS\\$($UserProfile.SID)\" -DisplayName \"Firefox\" | ForEach-Object { \r\n            $FireFoxInstallations = $True\r\n        }\r\n        Find-InstallKey -UserBaseKey \"Registry::HKEY_USERS\\$($UserProfile.SID)\" -DisplayName \"Edge\" | ForEach-Object { \r\n            $EdgeInstallations = $True\r\n        }\r\n\r\n        # Unload NTuser.dat\r\n        If ($ProfileWasLoaded -eq $false) {\r\n            [gc]::Collect()\r\n            Start-Sleep 1\r\n            Start-Process -FilePath \"cmd.exe\" -ArgumentList \"\/C reg.exe UNLOAD HKU\\$($UserProfile.SID)\" -Wait -WindowStyle Hidden | Out-Null\r\n        }\r\n    }\r\n\r\n    # Initialize a list to store details of detected browser extensions\r\n    $BrowserExtensions = New-Object System.Collections.Generic.List[object]\r\n\r\n    # If Chrome was found, search for Chrome extensions in each user's profile\r\n    if ($ChromeInstallations) {\r\n        Write-Host -Object \"A Google Chrome installation was detected. Searching Chrome for browser extensions...\"\r\n        $UserProfiles | ForEach-Object {\r\n            if (!(Test-Path -Path \"$($_.Path)\\AppData\\Local\\Google\\Chrome\\User Data\" -ErrorAction SilentlyContinue)) {\r\n                return\r\n            }\r\n\r\n            if(Test-Path -Path \"$($_.Path)\\AppData\\Local\\Google\\Chrome\\User Data\\Local State\" -ErrorAction SilentlyContinue){\r\n                $AllProfiles = Get-Content -Path \"$($_.Path)\\AppData\\Local\\Google\\Chrome\\User Data\\Local State\" | ConvertFrom-JSON\r\n            }\r\n\r\n            $PreferenceFiles = Get-ChildItem \"$($_.Path)\\AppData\\Local\\Google\\Chrome\\User Data\\*\\Preferences\" -Exclude \"System Profile\" | Select-Object -ExpandProperty Fullname\r\n\r\n            foreach ($PreferenceFile in $PreferenceFiles) {\r\n\r\n                $GooglePreferences = Get-Content -Path $PreferenceFile | ConvertFrom-Json\r\n                if($AllProfiles){\r\n                    $ProfileLocation = $PreferenceFile | Get-Item | Select-Object -ExpandProperty Directory | Split-Path -Leaf\r\n                    $ProfileName = $AllProfiles.profile.info_cache | Select-Object -ExpandProperty $ProfileLocation | Select-Object -ExpandProperty Name\r\n                }else{\r\n                    $ProfileName = $GooglePreferences.profile.name\r\n                }\r\n\r\n                foreach ($Extension in $GooglePreferences.extensions.settings.PSObject.Properties) {\r\n                    $BrowserExtensions.Add(\r\n                        [PSCustomObject]@{\r\n                            Browser        = \"Chrome\"\r\n                            User           = $_.UserName\r\n                            Profile        = $ProfileName\r\n                            Name           = $Extension.Value.manifest.name\r\n                            \"Extension ID\" = $Extension.name\r\n                            Description    = $Extension.Value.manifest.description\r\n                        }\r\n                    )\r\n                }\r\n            }\r\n        }\r\n    }\r\n\r\n    # If Edge was found, search for Edge extensions in each user's profile\r\n    if ($EdgeInstallations) {\r\n        Write-Host -Object \"A Microsoft Edge installation was detected. Searching Microsoft Edge for browser extensions...\"\r\n        $UserProfiles | ForEach-Object {\r\n            if (!(Test-Path -Path \"$($_.Path)\\AppData\\Local\\Microsoft\\Edge\\User Data\" -ErrorAction SilentlyContinue)) {\r\n                return\r\n            }\r\n\r\n            if(Test-Path -Path \"$($_.Path)\\AppData\\Local\\Microsoft\\Edge\\User Data\\Local State\" -ErrorAction SilentlyContinue){\r\n                $AllProfiles = Get-Content -Path \"$($_.Path)\\AppData\\Local\\Microsoft\\Edge\\User Data\\Local State\" | ConvertFrom-JSON\r\n            }\r\n\r\n            $PreferenceFiles = Get-ChildItem \"$($_.Path)\\AppData\\Local\\Microsoft\\Edge\\User Data\\*\\Preferences\" -Exclude \"System Profile\" | Select-Object -ExpandProperty Fullname\r\n\r\n            foreach ($PreferenceFile in $PreferenceFiles) {\r\n\r\n                $EdgePreferences = Get-Content -Path $PreferenceFile | ConvertFrom-Json\r\n                if($AllProfiles){\r\n                    $ProfileLocation = $PreferenceFile | Get-Item | Select-Object -ExpandProperty Directory | Split-Path -Leaf\r\n                    $ProfileName = $AllProfiles.profile.info_cache | Select-Object -ExpandProperty $ProfileLocation | Select-Object -ExpandProperty Name\r\n                }else{\r\n                    $ProfileName = $EdgePreferences.profile.name\r\n                }\r\n\r\n                foreach ($Extension in $EdgePreferences.extensions.settings.PSObject.Properties) {\r\n                    if ($Extension.Value.active_bit -like \"False\" ) { continue }\r\n                    if (!$Extension.Value.manifest.name) { continue }\r\n                    $BrowserExtensions.Add(\r\n                        [PSCustomObject]@{\r\n                            Browser        = \"Edge\"\r\n                            User           = $_.UserName\r\n                            Profile        = $ProfileName\r\n                            Name           = $Extension.Value.manifest.name\r\n                            \"Extension ID\" = $Extension.name\r\n                            Description    = $Extension.Value.manifest.description\r\n                        }\r\n                    )\r\n                }\r\n            }\r\n        }\r\n    }\r\n\r\n    # If Firefox was found, search for Firefox extensions in each user's profile\r\n    if ($FireFoxInstallations) {\r\n        Write-Host -Object \"A Firefox installation was detected. Searching Firefox for browser extensions...\" \r\n        $UserProfiles | ForEach-Object {\r\n            if (!(Test-Path -Path \"$($_.Path)\\AppData\\Roaming\\Mozilla\\Firefox\\Profiles\" -ErrorAction SilentlyContinue)) {\r\n                return\r\n            }\r\n\r\n            $FirefoxProfileFolders = Get-ChildItem -Path \"$($_.Path)\\AppData\\Roaming\\Mozilla\\Firefox\\Profiles\" -Directory | Where-Object { $_.Name -match \"\\.default-release$\" } | Select-Object -ExpandProperty Fullname\r\n\r\n            foreach ( $FirefoxProfile in $FirefoxProfileFolders ) {\r\n\r\n                if (!(Test-Path -Path \"$FirefoxProfile\\extensions.json\")) {\r\n                    continue\r\n                }\r\n\r\n                $Extensions = Get-Content -Path \"$FirefoxProfile\\extensions.json\" | ConvertFrom-Json\r\n\r\n                foreach ($Extension in $Extensions.addons) {\r\n                    $BrowserExtensions.Add(\r\n                        [PSCustomObject]@{\r\n                            Browser        = \"Firefox\"\r\n                            User           = $_.UserName\r\n                            Profile        = \"N\/A\"\r\n                            Name           = $Extension.defaultlocale.name\r\n                            \"Extension ID\" = $Extension.id\r\n                            Description    = $Extension.defaultlocale.description\r\n                        }\r\n                    )\r\n                }\r\n            }\r\n        }\r\n    }\r\n\r\n    # Check if there are any browser extensions to process\r\n    if ($BrowserExtensions.Count -gt 0) {\r\n        # Format the BrowserExtensions list to include a shortened description if the description is too long.\r\n        $BrowserExtensions = $BrowserExtensions | Select-Object Browser, User, Profile, Name, \"Extension ID\", @{\r\n            Name       = \"Description\"\r\n            Expression = {\r\n                $Characters = $_.Description | Measure-Object -Character | Select-Object -ExpandProperty Characters\r\n                if ($Characters -gt 75) {\r\n                    \"$(($_.Description).SubString(0,75))(...)\"\r\n                }\r\n                else {\r\n                    $_.Description\r\n                }\r\n            }\r\n        }\r\n    }\r\n\r\n    # Check if extensions were found and if we were requested to set a multiline custom field\r\n    if ($BrowserExtensions.Count -gt 0 -and $MultilineCustomField) {\r\n        try {\r\n            Write-Host \"Attempting to set Custom Field '$MultilineCustomField'.\"\r\n            $CustomFieldValue = New-Object System.Collections.Generic.List[string]\r\n\r\n            # Sort and format the list of extensions for output\r\n            $CustomFieldList = $BrowserExtensions | Sort-Object Browser, User, Profile, Name | Select-Object Browser, User, Profile, Name, \"Extension ID\", Description\r\n            $CustomFieldValue.Add(($CustomFieldList | Format-List | Out-String))\r\n\r\n            # Measure the total character count of the formatted string\r\n            $Characters = $CustomFieldValue | Out-String | Measure-Object -Character | Select-Object -ExpandProperty Characters\r\n            if ($Characters -ge 9500) {\r\n                Write-Warning \"10,000 Character Limit has been reached! Trimming output until the character limit is satisfied...\"\r\n                    \r\n                # If it doesn't comply with the limits we'll need to recreate it with some adjustments.\r\n                $i = 0\r\n                do {\r\n                    # Recreate the custom field output starting with a warning that we truncated the output.\r\n                    $CustomFieldValue = New-Object System.Collections.Generic.List[string]\r\n                    $CustomFieldValue.Add(\"This info has been truncated to accommodate the 10,000 character limit.\")\r\n                    \r\n                    # Flip the array so that the last entry is on top.\r\n                    [array]::Reverse($CustomFieldList)\r\n    \r\n                    # Remove the next item.\r\n                    $CustomFieldList[$i] = $null\r\n                    $i++\r\n    \r\n                    # We'll flip the array back to right side up.\r\n                    [array]::Reverse($CustomFieldList)\r\n    \r\n                    # Add it back to the output.\r\n                    $CustomFieldValue.Add(($CustomFieldList | Format-List | Out-String))\r\n    \r\n                    # Check that we now comply with the character limit. If not restart the do loop.\r\n                    $Characters = $CustomFieldValue | Out-String | Measure-Object -Character | Select-Object -ExpandProperty Characters\r\n                }while ($Characters -ge 9500)\r\n            }\r\n\r\n            Set-NinjaProperty -Name $MultilineCustomField -Value $CustomFieldValue\r\n            Write-Host \"Successfully set Custom Field '$MultilineCustomField'!\"\r\n        }\r\n        catch {\r\n            Write-Host \"[Error] $($_.Exception.Message)\"\r\n            $ExitCode = 1\r\n        }\r\n    }\r\n\r\n    # Check if extensions were found and if we were requested to set a WYSIWYG custom field.\r\n    if ($BrowserExtensions.Count -gt 0 -and $WysiwygCustomField) {\r\n        try {\r\n            Write-Host \"Attempting to set Custom Field '$WysiwygCustomField'.\"\r\n    \r\n            # Prepare the custom field output.\r\n            $CustomFieldValue = New-Object System.Collections.Generic.List[string]\r\n    \r\n            # Convert the matching events into an html report.\r\n            $htmlTable = $BrowserExtensions | Sort-Object Browser, User, Profile, Name | Select-Object Browser, User, Profile, Name, \"Extension ID\", Description | ConvertTo-Html -Fragment\r\n    \r\n            # Add the newly created html into the custom field output.\r\n            $CustomFieldValue.Add($htmlTable)\r\n    \r\n            # Check that the output complies with the hard character limits.\r\n            $Characters = $CustomFieldValue | Out-String | Measure-Object -Character | Select-Object -ExpandProperty Characters\r\n            if ($Characters -ge 199500) {\r\n                Write-Warning \"200,000 Character Limit has been reached! Trimming output until the character limit is satisfied...\"\r\n                    \r\n                # If it doesn't comply with the limits we'll need to recreate it with some adjustments.\r\n                $i = 0\r\n                do {\r\n                    # Recreate the custom field output starting with a warning that we truncated the output.\r\n                    $CustomFieldValue = New-Object System.Collections.Generic.List[string]\r\n                    $CustomFieldValue.Add(\"&lt;h1&gt;This info has been truncated to accommodate the 200,000 character limit.&lt;\/h1&gt;\")\r\n    \r\n                    # Flip the array so that the last entry is on top.\r\n                    [array]::Reverse($htmlTable)\r\n                    # If the next entry is a row we'll delete it.\r\n                    if ($htmlTable[$i] -match '&lt;tr&gt;&lt;td&gt;' -or $htmlTable[$i] -match '&lt;tr class=') {\r\n                        $htmlTable[$i] = $null\r\n                    }\r\n                    $i++\r\n                    # We'll flip the array back to right side up.\r\n                    [array]::Reverse($htmlTable)\r\n    \r\n                    # Add it back to the output.\r\n                    $CustomFieldValue.Add($htmlTable)\r\n    \r\n                    # Check that we now comply with the character limit. If not restart the do loop.\r\n                    $Characters = $CustomFieldValue | Out-String | Measure-Object -Character | Select-Object -ExpandProperty Characters\r\n                }while ($Characters -ge 199500)\r\n            }\r\n    \r\n            # Set the custom field.\r\n            Set-NinjaProperty -Name $WysiwygCustomField -Value $CustomFieldValue\r\n            Write-Host \"Successfully set Custom Field '$WysiwygCustomField'!\"\r\n        }\r\n        catch {\r\n            Write-Host \"[Error] $($_.Exception.Message)\"\r\n            $ExitCode = 1\r\n        }\r\n    }\r\n\r\n    if ($BrowserExtensions.Count -gt 0) {\r\n        Write-Host \"Browser extensions were detected.\"\r\n        $BrowserExtensions | Sort-Object Browser, User, Profile, Name | Format-List | Out-String | Write-Host\r\n    }\r\n    else {\r\n        Write-Host \"No browser extensions were found!\"\r\n    }\r\n\r\n    exit $ExitCode\r\n}\r\nend {\r\n    \r\n    \r\n    \r\n}<\/pre>\n<p>&nbsp;<\/p>\n\n<div class=\"in-context-cta\"><p>Greifen Sie auf \u00fcber 300 Skripte im NinjaOne Dojo zu.<\/p>\n<p><a href=\"https:\/\/www.ninjaone.com\/freetrialform\/\">Zugang erhalten<\/a><\/p>\n<\/div>\n<h2>Detailansicht<\/h2>\n<p>Dieses Skript ist in PowerShell geschrieben und erfordert Version 5.1 oder h\u00f6her. Im Folgenden wird Schritt f\u00fcr Schritt erkl\u00e4rt, wie es funktioniert:<\/p>\n<h3>1. Initialisierung und Parameter:<\/h3>\n<ul>\n<li>Das Skript beginnt mit der \u00dcberpr\u00fcfung auf die erforderlichen Parameter $MultilineCustomField und $WysiwygCustomField, die \u00fcber Umgebungsvariablen gesetzt oder direkt \u00fcbergeben werden k\u00f6nnen.<\/li>\n<li>Um Konflikte zu vermeiden, wird \u00fcberpr\u00fcft, ob diese Felder, sofern sie beide vorhanden sind, nicht identisch sind.<\/li>\n<\/ul>\n<h3>2. Abrufen von Benutzer:in-Hive:<\/h3>\n<ul>\n<li>Die Funktion Get-UserHives identifiziert Benutzerprofile auf dem System, einschlie\u00dflich AzureAD- und Domainkonten.<\/li>\n<li>Diese Funktion ist entscheidend daf\u00fcr, dass das Skript alle relevanten Benutzerverzeichnisse nach Browserdaten durchsucht.<\/li>\n<\/ul>\n<h3>3. Erlaubnispr\u00fcfung:<\/h3>\n<ul>\n<li>Die Funktion Test-IsElevated stellt sicher, dass das Skript mit Administratorrechten ausgef\u00fchrt wird, die f\u00fcr den Zugriff auf benutzerspezifische Registrierungs-Hives und Verzeichnisse erforderlich sind.<\/li>\n<\/ul>\n<h3>4. Browser-Erkennung:<\/h3>\n<ul>\n<li>Das Skript sucht nach Installationen von Chrome, Firefox und Edge mit der Funktion Find-InstallKey, die sowohl systemweite als auch benutzerspezifische Registrierungsschl\u00fcssel durchsucht.<\/li>\n<\/ul>\n<h3>5. Abrufen von Profilen:<\/h3>\n<ul>\n<li>F\u00fcr jeden erkannten Browser durchl\u00e4uft das Skript die Benutzerprofile, l\u00e4dt die erforderlichen Registrierungshives und sucht nach Browser-Erweiterungs-Daten.<\/li>\n<li>Dabei werden bestimmte Verzeichnisse und Konfigurationsdateien \u00fcberpr\u00fcft, in denen die Browser Erweiterungsinformationen speichern.<\/li>\n<\/ul>\n<h3>6. Datensammlung:<\/h3>\n<ul>\n<li>Es stellt eine Liste der installierten Erweiterungen zusammen, einschlie\u00dflich Details wie Browsernamen, Benutzern, Profil, Namen der Erweiterung, ID und Beschreibung.<\/li>\n<\/ul>\n<h3>7. Aktualisierungen der benutzerdefinierten Felder:<\/h3>\n<ul>\n<li>Wenn Erweiterungen gefunden werden, versucht das Skript, benutzerdefinierte Felder in einem Dokumentationssystem mithilfe von Set-NinjaProperty zu setzen. Es behandelt potenzielle Zeichenlimits, indem es die Ausgabe nach Bedarf anpasst.<\/li>\n<\/ul>\n<h3>8. Output:<\/h3>\n<ul>\n<li>Die endg\u00fcltige Ausgabe ist eine sortierte Liste von Browser-Erweiterungen, die angezeigt oder in benutzerdefinierten Feldern f\u00fcr weitere Analysen gespeichert werden kann.<\/li>\n<\/ul>\n<h2>Potenzielle Anwendungsf\u00e4lle<\/h2>\n<p>Stellen Sie sich vor, ein IT-Experte verwaltet die IT-Infrastruktur eines mittelst\u00e4ndischen Unternehmens. Er muss sicherstellen, dass alle auf den Rechnern der Benutzer:innen installierten Browser-Erweiterungen mit den Unternehmensrichtlinien \u00fcbereinstimmen. Wenn der IT-Experte dieses Skript ausf\u00fchrt, kann er schnell eine Bestandsaufnahme aller Erweiterungen in Chrome, Firefox und Edge machen, alle nicht autorisierten oder riskanten Erweiterungen identifizieren und entsprechende Ma\u00dfnahmen ergreifen.<\/p>\n<p>Wenn zum Beispiel eine neue Richtlinie Erweiterungen verbietet, die nicht von der IT-Abteilung gepr\u00fcft wurden, kann der IT-Administrator mit diesem Skript eine umfassende Liste der aktuellen Erweiterungen erstellen. Der Administrator kann diese Liste dann mit den genehmigten Erweiterungen abgleichen und solche, die ein Risiko darstellen, per Remote-Zugriff entfernen.<\/p>\n<h2>Vergleiche<\/h2>\n<p>Im Vergleich zu manuellen Methoden, bei denen jeder Browser und jedes Benutzerprofil einzeln \u00fcberpr\u00fcft wird, ist dieses Skript wesentlich effizienter und gr\u00fcndlicher. Andere Ans\u00e4tze bestehen in der Verwendung Browser-spezifischer Tools oder einer manuellen \u00dcberpr\u00fcfung, die beide zeitaufw\u00e4ndig und fehleranf\u00e4llig sind. Dieses Skript automatisiert den Prozess, sorgt f\u00fcr Konsistenz und spart wertvolle Zeit.<\/p>\n<h2>FAQs<\/h2>\n<h3>F: Kann dieses Skript remote ausgef\u00fchrt werden?<\/h3>\n<p>A: Ja, sofern Sie \u00fcber die erforderlichen Administratorrechte und den Zugang zu den remote Rechnern verf\u00fcgen.<\/p>\n<h3>F: Was passiert, wenn die Beschreibung einer Erweiterung die Zeichengrenze \u00fcberschreitet?<\/h3>\n<p>A: Das Skript passt die Beschreibung so an, dass sie in das Zeichenlimit passt und die Ausgabe \u00fcberschaubar bleibt.<\/p>\n<h3>F: Funktioniert das Skript auf allen Versionen von Windows?<\/h3>\n<p>A: Das Skript erfordert Windows 10 oder Windows Server 2016 und h\u00f6her, da es von den in diesen Versionen verf\u00fcgbaren Funktionen abh\u00e4ngt.<\/p>\n<h3>F: Kann das Skript ge\u00e4ndert werden, um andere Browser zu unterst\u00fctzen?<\/h3>\n<p>A: Ja, mit entsprechenden \u00c4nderungen an der Erkennungs- und Datenerfassungslogik kann die Unterst\u00fctzung f\u00fcr weitere Browser hinzugef\u00fcgt werden.<\/p>\n<h2>Folgen<\/h2>\n<p>Die Ergebnisse dieses Skripts k\u00f6nnen erhebliche Auswirkungen auf die IT-Sicherheit haben. Durch die Identifizierung aller installierten Browser-Erweiterungen k\u00f6nnen IT-Experten potenzielle Sicherheitsrisiken erkennen und Compliance sicherstellen. Dieser proaktive Ansatz tr\u00e4gt dazu bei, <a href=\"https:\/\/www.ninjaone.com\/de\/blog\/beste-loesungen-zum-schutz-gegen-malware\/\" target=\"_blank\" rel=\"noopener\">das Risiko von Malware-Infektionen<\/a> und Datenverst\u00f6\u00dfen im Zusammenhang mit b\u00f6sartigen oder schlecht gewarteten Erweiterungen <a href=\"https:\/\/www.ninjaone.com\/de\/blog\/beste-loesungen-zum-schutz-gegen-malware\/\" target=\"_blank\" rel=\"noopener\">zu verringern<\/a>.<\/p>\n<h2>Empfehlungen<\/h2>\n<p>Beachten Sie bei der Verwendung dieses Skripts die folgenden Best Practices:<\/p>\n<ul>\n<li>F\u00fchren Sie das Skript regelm\u00e4\u00dfig im Rahmen Ihres IT-Wartungszeitplans aus.<\/li>\n<li>\u00dcberpr\u00fcfen Sie die Liste der erkannten Erweiterungen und gleichen Sie sie mit Ihrer genehmigten Liste ab.<\/li>\n<li>Informieren Sie die Benutzer:innen \u00fcber die mit Browser-Erweiterungen verbundenen Risiken und empfehlen Sie ihnen, nur zugelassene Erweiterungen zu installieren.<\/li>\n<\/ul>\n<h2>Abschlie\u00dfende \u00dcberlegungen<\/h2>\n<p>Die Verwaltung von Browser-Erweiterungen ist ein bedeutender Aspekt der IT-Sicherheit. Dieses Skript bietet eine automatisierte, <a href=\"https:\/\/www.ninjaone.com\/de\/effizienz\/\" target=\"_blank\" rel=\"noopener\">effiziente<\/a> Methode zur Inventarisierung und \u00dcberwachung von Browser-Erweiterungen f\u00fcr mehrere Benutzer:innen und Browser. Durch die Integration dieses Tools in Ihre IT-Verwaltungsprozesse k\u00f6nnen Sie die Sicherheitslage Ihres Unternehmens verbessern und die Compliance gew\u00e4hrleisten.<\/p>\n<p><a href=\"https:\/\/www.ninjaone.com\/de\/\" target=\"_blank\" rel=\"noopener\">NinjaOne<\/a> bietet eine Reihe von Tools und Funktionen, die dieses Skript erg\u00e4nzen und dadurch eine umfassende L\u00f6sung f\u00fcr IT-Management und Sicherheit bieten. Mit NinjaOne k\u00f6nnen Sie Routineaufgaben automatisieren, Endpunkte \u00fcberwachen und sicherstellen, dass Ihre IT-Umgebung sicher und konform ist.<\/p>\n","protected":false},"author":35,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_acf_changed":false,"_relevanssi_hide_post":"","_relevanssi_hide_content":"","_relevanssi_pin_for_all":"","_relevanssi_pin_keywords":"","_relevanssi_unpin_keywords":"","_relevanssi_related_keywords":"","_relevanssi_related_include_ids":"","_relevanssi_related_exclude_ids":"","_relevanssi_related_no_append":"","_relevanssi_related_not_related":"","_relevanssi_related_posts":"","_relevanssi_noindex_reason":"","_lmt_disableupdate":"no","_lmt_disable":""},"operating_system":[4212],"use_cases":[4384,4383],"class_list":["post-377907","script_hub","type-script_hub","status-publish","hentry","script_hub_category-windows"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.ninjaone.com\/de\/wp-json\/wp\/v2\/script_hub\/377907","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ninjaone.com\/de\/wp-json\/wp\/v2\/script_hub"}],"about":[{"href":"https:\/\/www.ninjaone.com\/de\/wp-json\/wp\/v2\/types\/script_hub"}],"author":[{"embeddable":true,"href":"https:\/\/www.ninjaone.com\/de\/wp-json\/wp\/v2\/users\/35"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ninjaone.com\/de\/wp-json\/wp\/v2\/comments?post=377907"}],"wp:attachment":[{"href":"https:\/\/www.ninjaone.com\/de\/wp-json\/wp\/v2\/media?parent=377907"}],"wp:term":[{"taxonomy":"script_hub_category","embeddable":true,"href":"https:\/\/www.ninjaone.com\/de\/wp-json\/wp\/v2\/operating_system?post=377907"},{"taxonomy":"use_cases","embeddable":true,"href":"https:\/\/www.ninjaone.com\/de\/wp-json\/wp\/v2\/use_cases?post=377907"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}