Simple Powershell To Add Computers, For My Own Poor Memory, To ...

Skip to content Search Gists Search Gists All gists Back to GitHub Sign in Sign up Sign in Sign up Dismiss alert {{ message }}

Instantly share code, notes, and snippets.

@leeramsay leeramsay/add_computers_to_gpo.ps1 Last active November 18, 2025 12:43 Show Gist options
  • Star (4) You must be signed in to star a gist
  • Fork (0) You must be signed in to fork a gist
  • Embed Select an option
    • Embed Embed this gist in your website.
    • Share Copy sharable link for this gist.
    • Clone via HTTPS Clone using the web URL.

    No results found

    Learn more about clone URLs Clone this repository at <script src="https://gist.github.com/leeramsay/66e07cbe1f6173d010bd1c98661a3425.js"></script>
  • Save leeramsay/66e07cbe1f6173d010bd1c98661a3425 to your computer and use it in GitHub Desktop.
Code Revisions 2 Stars 4 Embed Select an option
  • Embed Embed this gist in your website.
  • Share Copy sharable link for this gist.
  • Clone via HTTPS Clone using the web URL.

No results found

Learn more about clone URLs Clone this repository at <script src="https://gist.github.com/leeramsay/66e07cbe1f6173d010bd1c98661a3425.js"></script> Save leeramsay/66e07cbe1f6173d010bd1c98661a3425 to your computer and use it in GitHub Desktop. Download ZIP 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. Raw readme.md

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.

Raw add_computers_to_gpo.ps1 This file contains hidden or 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 Show hidden 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 You can’t perform that action at this time.

Tag » Add Computer To Group Powershell