Get-GphPrefRunOnceKey.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
function Get-GphPrefRunOnceKey
{
  <#
    .SYNOPSIS
    Returns all RunonceKeys from GroupPolicyPreferences
 
    .DESCRIPTION
    RunOnceKeys are set if a GrouppolicyPreference-Setting shall only be run once. It can be set
    in the GUI and is saved in the registry after the first run. Run Get-GphPrefRunOnceKey to show
    all the stored RunonceKeys.
 
    .EXAMPLE
    Get-GphPrefRunOnceKey
     
    Clears all Runonce-Keys
 
    .NOTES
    Author: Holger Voges
    Date: 2018-11-16
    Version: 1.0
  #>



[cmdletbinding()]
param()

  $RegKeyComputer = 'Registry::HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\GROUP POLICY\CLIENT\RUNONCE'
  $RegKeyUser = 'Registry::HKEY_CURRENT_USER\SOFTWARE\MICROSOFT\GROUP POLICY\CLIENT\RUNONCE'

  Get-Item -Path $RegKeyComputer -ErrorAction SilentlyContinue
  Get-Item -Path $RegKeyUser -ErrorAction SilentlyContinue

}