This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Get-GPO -All | ForEach-Object { | |
# Test if Authenticated Users group have at least read permission on the GPO | |
if ('S-1-5-11' -notin ($_ | Get-GPPermission -All).Trustee.Sid.Value) { | |
$_ | |
} | |
} | Select DisplayName |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add-Type @" | |
using System; | |
using System.Runtime.InteropServices; | |
public static class Win32Api | |
{ | |
[System.Runtime.InteropServices.DllImportAttribute( "User32.dll", EntryPoint = "GetWindowThreadProcessId" )] | |
public static extern int GetWindowThreadProcessId ( [System.Runtime.InteropServices.InAttribute()] System.IntPtr hWnd, out int lpdwProcessId ); | |
[System.Runtime.InteropServices.DllImportAttribute( "User32.dll", EntryPoint = "GetForegroundWindow" )] | |
public static extern IntPtr GetForegroundWindow(); | |
} |
NewerOlder