AdsiPS icon indicating copy to clipboard operation
AdsiPS copied to clipboard

Group Policy Objects

Open lazywinadmin opened this issue 9 years ago • 2 comments

Is there anyway to retrieve Group policy objects, Links, permissions, using .NET ?

I already have some basic code here Get-ADSIGroupPolicyObject but it is far from perfect.

I would like to have the same approach as Get-ADSIUser, that I'm reusing in Remove-ADSIUser, Unlock-ADSIUser, Enable-ADSIUSer, Disable-ADSIUser

lazywinadmin avatar Aug 18 '16 02:08 lazywinadmin

There is maybe a way by using the GPMC assemblies, example:

$assembly=[reflection.assembly]::Load("Microsoft.GroupPolicy.Management, Version=2.0.0.0, Culture=neutral,PublicKeyToken=31bf3856ad364e35")
$domain = new-object Microsoft.GroupPolicy.GPDomain
$domain.GetAllGpos()

More about the namespace: Microsoft.GroupPolicy namespace

MickyBalladelli avatar Aug 19 '16 11:08 MickyBalladelli

Thanks @MickyBalladelli ! Yeah I guess I could take this approach I was just hoping i could rely on .net

lazywinadmin avatar Aug 19 '16 14:08 lazywinadmin