Get-GphGpExtensions.ps1

#requires -Version 1.0
function Get-GphGpExtensions {
  <#
      .SYNOPSIS
      Gets all installed Group Policy Extensions from the Registry
 
      .DESCRIPTION
      All Group Policy Extensions must be registered in the Registry. Get-GPExtension retrieves them from
      HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\GPExtensions and shows them in their
      processing-order. It can also show the Configuration-Settings of the Extensions by using the Parameter
      -Showregkeys.
 
      .EXAMPLE
      Get-GPExtensions -ShowRegKeys
      Gets all Extension and their Settings
  #>



  [CmdletBinding()]
  param(
    # Get all Registry-Settings for the Extension
    [switch]$ShowRegKeys
  )
    
  # Unnamed Extension have no name set in the registry.
  $UnnamedExtensions = @{
    '{35378EAC-683F-11D2-A89A-00C04FBBCFA2}' = 'Registry Settings'
    '{4D2F9B6F-1E52-4711-A382-6A8B1A003DE6}' = 'TS Workspace'
    '{F312195E-3D9D-447A-A3F5-08DFFA24735E}' = 'Device Guard'
    '{FC491EF1-C4AA-4CE1-B329-414B101DB823}' = 'Device Guard'
  }

    $gpExtensionsPath = 'Registry::Hkey_local_machine\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\GPExtensions'
    $SpalteDefault = @{ Name='Extension Name'
                        expression= { if ( $_.'(Default)' ) { $_.'(Default)'} Else { $UnnamedExtensions.($_.PSChildName) } } }
    $SpalteGUID = @{ Name='GUID'
                     expression = { $_.PSChildName }}
    $SelectParam = @{ Property=$SpalteGUID,$SpalteDefault,'ProcessGroupPolicy','DllName' }
    $Extensions = 'Guid',
             'Extension Name',
             'DllName',
             'ProcessGroupPolicy',
             'ProcessGroupPolicyEx',
             'GenerateGroupPolicy',
             'EnableAsynchronousProcessing',
             'ExtensionEventSource',
             'MaxNoGPOListChangesInterval',
             'NoBackgroundPolicy',
             'NoGPOListChanges',
             'NoMachinePolicy',
             'NoSlowLink',
             'NotifyLinkTransition',
             'NoUserPolicy',
             'PerUserLocalSettings',
             'RequiresSuccessfulRegistry'

    If ( $ShowRegKeys ) { 1 | Select-Object -Property $Extensions }
    Get-ChildItem -Path $gpExtensionsPath | ForEach-Object { 
       $Regkeys = $_ | Get-ItemProperty  
       If ( $ShowRegKeys )
       {
            $RegKeys | Select-Object -Property $SpalteGuid,$SpalteDefault,*
       }
       Else 
       {
         if ( $regkeys )
                { $RegKeys | Select-Object @SelectParam }
         Else {$_ | Select-Object @SelectParam }
       }
    }
}