Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Take a look at this <a href="http://www.microsoft.com/downloads/en/details.aspx?FamilyId=38C1A89B-A6D2-4F2A-A944-9236999AEE65&amp;displaylang=en" rel="nofollow">link</a></p> <p>It contains a lot of sample scripts, you will need to add a reference (COM) to GPO Admin 1.0 Type Library from GPOAdmin.dll.</p> <p>There is a similar issue discussed <a href="http://social.msdn.microsoft.com/Forums/en/csharpgeneral/thread/f3f5a61f-2ab9-459e-a1ee-c187465198e0" rel="nofollow">here</a> with a sample script in C#</p> <p><strong>EDIT</strong>: </p> <p>Reference gpmgmt.dll as COM interop and use the code as below:</p> <pre><code>Public Function CreateAndLinkGPO(ByVal strDomain As String, ByVal strOU As String, ByVal strGPOName As String) Dim gpm As New GPM() Dim gpmConst As GPMConstants = gpm.GetConstants() Dim domain As GPMDomain = gpm.GetDomain(strDomain, "", gpmConst.UseAnyDC) Dim som As GPMSOM = domain.GetSOM(strOU) 'create new GPO Dim gpo As GPMGPO = domain.CreateGPO() gpo.DisplayName = strGPOName 'create link to OU som.CreateGPOLink(-1, gpo) CreateAndLinkGPO = gpo End Function </code></pre> <p>This is in VB.NET, but can be easily ported to C# posted by a <a href="http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/fcbd4eae-96c7-4a5f-8e5a-cf5b8a2542c7/" rel="nofollow">MSFT poster from here</a>. I think the key is .<a href="http://msdn.microsoft.com/en-us/library/aa373492%28v=vs.85%29.aspx" rel="nofollow">CreateGPOLink</a>, <a href="http://msdn.microsoft.com/en-us/library/aa814192%28v=vs.85%29.aspx" rel="nofollow">GPMSOM</a> is your OU (Retrieves the IGPMSOM interface that represents the domain or the organizational unit (OU) at the specified path.)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload