{"id":15714406,"url":"https://github.com/jesselawson/migrate-adgroups","last_synced_at":"2025-03-30T19:46:54.414Z","repository":{"id":71056353,"uuid":"137388945","full_name":"jesselawson/migrate-adgroups","owner":"jesselawson","description":"Migrate Active Directory groups from one OU to another in PowerShell. Works across servers.","archived":false,"fork":false,"pushed_at":"2018-06-20T17:31:56.000Z","size":30,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-05T22:36:55.076Z","etag":null,"topics":["active-directory","migration-tool","powershell"],"latest_commit_sha":null,"homepage":null,"language":"PowerShell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jesselawson.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-06-14T17:30:59.000Z","updated_at":"2018-06-19T00:12:30.000Z","dependencies_parsed_at":"2023-02-22T02:15:17.454Z","dependency_job_id":null,"html_url":"https://github.com/jesselawson/migrate-adgroups","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jesselawson%2Fmigrate-adgroups","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jesselawson%2Fmigrate-adgroups/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jesselawson%2Fmigrate-adgroups/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jesselawson%2Fmigrate-adgroups/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jesselawson","download_url":"https://codeload.github.com/jesselawson/migrate-adgroups/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246372503,"owners_count":20766626,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["active-directory","migration-tool","powershell"],"created_at":"2024-10-03T21:36:38.432Z","updated_at":"2025-03-30T19:46:54.394Z","avatar_url":"https://github.com/jesselawson.png","language":"PowerShell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Migrate ADGroups\n\nA simple PS CLI tool to migrate one set of Active Directory group containers from one OU folder to another. \n\n## Quickstart\n\n### Parameters\n\n| Param                 | Type                  | Example                       | Default                                              |\n|:----------------------|:----------------------|:-----------------------------------------------------------------|:------------------|\n| -SourceServer         | String, Optional      | `-SourceServer \"example.com\"`                                    | (none; mandatory) |\n| -SourcePath           | String, Mandatory     | `-SourcePath \"OU=Folder,OU=AnotherFolder,DC=example,DC=com`      | (none; mandatory) |\n| -DestinationServer    | String, Optional      | `-DestinationServer \"example.com\"`                               | (none; mandatory) |\n| -DestinationPath      | String, Mandatory     | `-DestinationPath \"OU=Folder,OU=AnotherFolder,DC=example,DC=com` | (none; mandatory) |\n| -UsersServer          | String, Mandatory     | `-UsersServer \"example.com\"`                                     | (none; mandatory) |\n| -FixConflictsByAdding | String, Optional      | `-FixConflictsByAdding \"Report Viewer\"`                          | (none)            |\n| -ShowConflicts        | Switch, Optional      | `-ShowConflicts`                                                 | off               |\n| -Verbose              | Switch, Optional      | `-Verbose`                                                       | off               |\n\n### Param Details \n* **-SourceServer \u003cstring\u003e**: The Name.ParentDomain of the AD server you're migrating from.\n* **-SourcePath \u003cstring\u003e**: The DistinguishedName of the OU where the AD Groups you want to migrate are.\n* **-DestinationServer \u003cstring\u003e**: The Name.ParentDomain of the AD server you're migrating to.\n* **-DestinationPath \u003cstring\u003e**: The DistinguishedName of the OU where you want to migrate the AD Groups in the SourcePath to.\n* **-UsersServer \u003cstring\u003e**: Specify the AD server where the user accounts exist.\n* **-FixConflictsByAdding \u003cstring\u003e**: If there's a group conflict, fix it by creating a new group with \u003cstring\u003e appended.\n* **-ShowConflicts**: Will give you a table (console + txt file) of migration conflicts that ocurred during migration.\n* **-Verbose**: Activate sadist mode.\n\n### Example\n\n```powershell\nPS C:\\Jesse\u003e .\\migrate-adgroups.ps1 -SourceServer \"source.abc\" -SourcePath \"OU=SourceInnerFolder,OU=SourceOuterFolder,DC=source,DC=abc\" -DestinationServer \"destination.xyz\" \"OU=DestinationInnerFolder,OU=DestinationOuterFolder,DC=destination,DC=xyz\" -UsersServer \"destination.xyz\"\n```\n\n## Usage\n\nThe following is just an example.\n\nLet's say you have a bunch of AD Groups on `garage.com` and I want to move them over to `kitchen.com`. The groups on the source folder, garage, are inside specific folders (like this: `SourceOuterFolder/SourceInnerFolder/\u003cgroup\u003e`) and I want them to go to the destination folder in the same way (i.e., `DestinationOuterFolder/DestinationInnerFolder/\u003cgroup\u003e`).\n\nSo as an example, if I were to open AD Users and Computers, I might see something like this:\n\n```\nActive Directory Users and Computers [dc.garage.com]\ngarage.com\n- SourceOuterFolder\n- - SourceInnerFolder \n- - - Group A\n- - - Group B\n- - - Group N\n```\n\nWhat I want is to copy everything from `SourceInnerFolder` to an OU on a destination server that I am calling `DestinationInnerFolder`. I want 1) all groups copied over if they don't exist already, and 2) all users from the source group added to the new groups at the destination. \n\nSo the destination should look something like this:\n\n```\nActive Directory Users and Computers [dc.kitchen.com]\nkitchen.com\n- DestinationOuterFolder\n- - DestinationInnerFolder\n- - - Group A\n- - - Group B\n- - - Group C\n```\n\nHere's how I would do that:\n\n```powershell\nPS C:\\Jesse\u003e .\\migrate-adgroups.ps1 -SourceServer \"garage.com\" -SourcePath \"OU=SourceInnerFolder,OU=SourceOuterFolder,DC=garage,DC=com\" -DestinationServer \"kitchen.com\" \"OU=DestinationInnerFolder,OU=DestinationOuterFolder,DC=kitchen,DC=com\"\n```\n\n### How does this work\n\nThe path variables (that you see for the `-SourceServer` and `-DestinationServer` parameters) are the DistinguishedNames minus the `CN=*` part. An Active Directory Object's distinguished name is basically like an address mapping straight to that AD Object. \n\nFor example, if I had the following in AD Users and Groups:\n\n```\nActive Directory Users and Computers [dc.kitchen.com]\nkitchen.com\n- Appliances\n- - Food and Beverage\n- - - Toaster\n- - - Fridge\n- - - Oven\n```\n\n... then I could give you the path to each of the groups in the `Food and Beverage` OU by looking up their distinguished names:\n\n| AD Group | DistinguishedName |\n|:---------|:------------------|\n| Toaster  | CN=Toaster,OU=Food and Beverage,OU=Appliances,DC=kitchen,DC=com |\n| Fridge   | CN=Fridge,OU=Food and Beverage,OU=Appliances,DC=kitchen,DC=com |\n| Oven     | CN=Oven,OU=Food and Beverage,OU=Appliances,DC=kitchen,DC=com |\n\nSo, when you pass a path variable, you are basically saying \"use this as the second part of the distinguishedName,\" where the first part will be \"CN=\u003cgroupname\u003e.\"\n\nWhen using `migrate-adgroups`, you want to pass the source Path as the OU hierarchy where all the CN's (the groups) live. You want to do the **same thing** for the source path. \n\n### Important Considerations \n\n* A group existing on your destination server but not necessarily in your destination path will trigger a merge conflict, BUT that group will be used for the migration.\n\n* The script will straight up ignore any groups from the source if there is an AD account with the same name on the target. You'll have to manually move these over (sorry). Look on the bright side, though: at least you get a handy `merge-conflicts.txt` file that gives you a checklist of which ones you need to worry about!\n\n* This script DOES NOT migrate groups inside groups. In other words, it only migrates a folder of groups that contain users--it will not migrate a folder of groups that may contain other groups.\n\n## Optional Flags\n\n### -ShowConflicts\n\nIf you enable the ShowConflicts flag, you'll get a table at the end of the migration that shows you all of the migration conflicts. There are really only two conflicts that can occur: either A) your group name already exists as a group on the destination server, or B) your group name already exists as an account on the destination server. The former type of conflicts are easily ignored, but the latter are ones that will cause headaches. \n\nExample output: \n\n```\nName \t\t\tValue\nMy Group \t\tAn account with this name already exists in the destination server, preventing a group with the same name from being migrated.\nSome Group \t\tThis group already exists on the destination server.\nAnother Group \t\tThis group already exists on the destination server.\nOne Group \t\tAn account with this name already exists in the destination server, preventing a group with the same name from being migrated.\nTwo Group \t\tThis group already exists on the destination server.\nRed Group \t\tAn account with this name already exists in the destination server, preventing a group with the same name from being migrated.\nBlue Group \t\tThis group already exists on the destination server.\n```\n\n## Changelog\n\n**1.1**\n- Added `-FixConflictsByAdding` param\n\n**1.0**\n- Initial Release","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjesselawson%2Fmigrate-adgroups","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjesselawson%2Fmigrate-adgroups","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjesselawson%2Fmigrate-adgroups/lists"}