title: How to get/set/update registry value through group policy cmdlet of Windows PowerShell?
body: <p>I have configured the EventForwarding Manually but I was wondeing If I could do it programmatically and I came across the <a href="http://technet.microsoft.com/en-us/library/ee461040" rel="nofollow noreferrer">Group Policy Cmdlets</a> which seems to be the solution. Here is what I am trying to configure manually in the image below.</p>
  
  <p><img src="https://i.stack.imgur.com/OyHor.jpg" alt="Event Forwarding Policy Config"></p>
  
  <p>When I run the <strong>Get-GPO -all</strong> cmdlet I don't see any GPOs related to Event Forwarding. However when I ran the <strong>Get-GPResultantSetOfPolicy</strong> with the specified path of an XML file, I got to see my configuration of the Subscription manager of the Event Forwarding. </p>
  
  <p>Question 1: Why isn't the event forwarding policy shown in <strong>Get-GPO -all</strong> result?</p>
  
  <p>Question 2: How to find out the GUID of the policy I need so I can use the <strong><a href="http://technet.microsoft.com/en-us/library/ee461040" rel="nofollow noreferrer">Get-GPRegistryValue</a></strong>? besides providing the Key (which I was able to find and verfiy that it has my configuration that I have done through the gpedit.msc UI. </p>
  
  <p>Question 3: How to figure out the display name of the policy in question? I tried the following:</p>
  
  <pre><code>PS C:\Windows\PolicyDefinitions&gt; Get-GPRegistryValue -Name SubscriptionManager -Key HKEY_LOCAL_MACHINE\SOFTWARE\Policies
  \Microsoft\Windows\EventLog\EventForwarding\SubscriptionManager
  </code></pre>
  
  <p>Where I tried for the Name attribute different things like : "EventForwarding", "EventForward", "SubscriptionManager" and even "Configure target Subscription Manager".
  And here is what I got :</p>
  
  <pre><code>***Get-GPRegistryValue : The command cannot be completed because a GPO that is named "SubscriptionManager" was not found
  in the nfstest.stbtest.microsoft.com domain. Make sure that the GPO that is specified by the Name parameter exists in
  the domain that is specified for the cmdlet. Then, run the command again.
  Parameter name: Name
  At line:1 char:1
  + Get-GPRegistryValue -Name SubscriptionManager -Key HKEY_LOCAL_MACHINE\SOFTWARE\P ...
  + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo          : ObjectNotFound: (Microsoft.Group...tryValueCommand:GetGPRegistryValueCommand) [Get-GPReg
     istryValue], ArgumentException
      + FullyQualifiedErrorId : GpoWithNameNotFound,Microsoft.GroupPolicy.Commands.GetGPRegistryValueCommand***
  </code></pre>
  
  <p>Any Help regarding any of the three related questions would be appreciated. </p>
  
  <p><strong>EDIT 1</strong>:</p>
  
  <p>As you can see in the image below, when I manually configure taregt subscription manager, I get the key <em>HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\EventLog\EventForwarding\SubscriptionManager</em> in the registry. My question for now is simple, how can I do that with cmdlets? All what I tried so far didn't create that key for me in the registry , NOT the AD.</p>
  
  <p>Thanks</p>