Add computer accounts to Active Directory groups during ConfigMgr OSD with verification, retries, compatibility modes, and CMTrace logging.
Current version: 1.0.1. The workflow publishes a prerelease candidate. Verify downloaded assets and obtain maintainer approval before promoting the candidate to a regular release marked latest; see the release process. Release status describes distribution, not platform certification. This README follows main; downloads are versioned snapshots.
Quick start | Deployment | Compatibility | Security | Troubleshooting
- Package
Scripts\Add-ComputerToADGroup.ps1and distribute it to the required ConfigMgr distribution points. - Run as Local System in full Windows, after domain join and the required restart, using Windows PowerShell 5.1. WinPE and PowerShell 7 are not supported runtimes.
- Immediately before the script step, create the hidden custom ConfigMgr Task Sequence variables
ADGroupUserNameandADGroupPasswordfor a dedicated account with delegated group-membership permissions. - Use a Run PowerShell Script step with
Scripts\Add-ComputerToADGroup.ps1as the script name and this value in Parameters:
-GroupName 'Workstation-Certificate-AutoEnroll'
- Clear both credential variables immediately afterward on success and failure, and preserve a failed script result.
The self-contained script defaults to Kerberos over LDAPS on TCP 636, with no automatic transport fallback or external runtime module dependency. It verifies direct membership and returns 0 only when all requested groups succeed; failures return 1.
Read deployment for prerequisites, cleanup handling, parameters, and log locations. Complete the environment-validation checklist before a staged rollout.
A ConfigMgr Task Sequence may need to add the newly joined computer to specific Active Directory groups. This project keeps that operation in a self-contained Windows PowerShell 5.1 utility, without RSAT or external runtime modules, with explicit authentication and transport settings, membership verification, retries, and logging.
- Kerberos over LDAPS on TCP 636 by default, without automatic authentication or transport fallback.
- Explicit
SignedLdaptransport on TCP 389 with signing and sealing. - Direct membership checks, with post-write verification for additions.
- Site-aware domain controller ordering and failover, with name-order fallback when the local site is unknown.
- Bounded retries with permanent/transient error classification.
- CMTrace-format logs with sanitized error messages and explicit
0/1exit codes. - Windows PowerShell 5.1 parser/analyzer checks, mocked Pester coverage, and a SHA-256 source manifest.
Read the documentation site or browse the same guides here on GitHub:
The v1.0.1 source passes Windows PowerShell 5.1 parser checks, PSScriptAnalyzer, mocked Pester tests, and exact-byte SHA-256 manifest verification. Tests cover parameter validation, LDAP requests, retry decisions, resource cleanup, logging, documentation, and validator process exits without writing to AD. Check CI for the status of a specific revision.
Live ConfigMgr and Active Directory testing was not executed for this release. Use the validation checklist to verify your environment. Windows Server 2012/2012 R2 remains best effort with WMF 5.1, not a verified platform.
Claudio Mendes · @vartaxe · vartaxe@outlook.com
MIT. See LICENSE.