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
Import-module activedirectory | |
$gMSAName = 'gMSA_Account_Name' ## Replace this value with new gMSA Name | |
$serverList = 'Server001','Server002','Server003','Server004','Server005' ## Replace with Server Names | |
$adOU = 'ou=Managed Service Accounts,OU=Service Accounts,DC=your_company,DC=com' ## Replace with actual AD OU | |
## Checking whether organizational unit exists, if not create it. | |
$ous = dsquery ou "$adOU" | |
if ($ous.count -eq 0) { | |
dsadd ou "$adOU" |