Simple Powershell to add computers, for my own poor memory, to add a computer, or multiples, to a group policy object under the "security filtering" section.
Last active
June 11, 2024 14:09
-
-
Save leeramsay/66e07cbe1f6173d010bd1c98661a3425 to your computer and use it in GitHub Desktop.
Simple Powershell to add computers, for my own poor memory, to add a computer, or multiples, to a group policy object under the "security filtering" section.
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
#To add: | |
# - Powershell Min version | |
# - Ad tools detection? | |
# - Instructions how to undo/remove computer/computers | |
# - Ability to run interactively, instead of copy/pasta | |
#Variables | |
$Domain = "example.domain" | |
$GPO_Name = "example GPO object" | |
$Computers_To_Add = "Example_PC1","Example_PC2","Example_PC3" | |
$Computer_To_Add = "Example_PC4" | |
#Business | |
$gpo = get-gpo -Domain $Domain -Name $GPO_Name | |
#Add single PC to GPO Security Filter | |
$gpo | Set-GPPermissions -domain $Domain -PermissionLevel gpoapply -TargetType computer -TargetName $Computer_To_Add | |
#Add multiple computers to GPO Security Filter | |
foreach ($Computer in $Computers_To_Add) { $gpo | Set-GPPermissions -domain $Domain -PermissionLevel gpoapply -TargetType computer -TargetName $Computer } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment