The AD ServiceAccount Manager is a powerful PowerShell script and tool designed to streamline the management of service accounts in an Active Directory environment.
It simplifies the creation, modification, and removal of both Group Managed Service Accounts (gMSA) and Standard Accounts (SSA), but also the migration to gSMA!.
I originally built this tool for internal use — it solved a very specific pain point for managing accounts across domains and OUs at a previous job.
Some sneak peak from the original private repo:
Your feedback and support are always welcome! 🤩🤘
Many existing solutions for managing etc. gMSA accounts (like the build-in MMC), lack the ease of use and cohesion that this tool provides. This PowerShell tool solves those issues by offering:
- Simplicity: Consolidates everything in one place—no need to search for scripts.
- Security: Confirmation prompts for high-risk tasks, with full logging for audit transparency.
- Efficiency: Handles your task easy and fast!
- Build confidence: Logging and confirmations provide peace of mind.
- Save time: No more script-hunting; everything is centralized.
- Reduce errors: User-friendly steps and prompts help avoid mistakes.
- Increase efficiency: Easily manage multiple service accounts in your enviroment!
Outline the file contents of the repository. It helps users navigate the codebase, build configuration and any related assets.
File/folder | Description |
---|---|
\src |
Source code. |
\docs |
Div. documents and information. |
\exports |
Exports in raw PowerShell code. |
.gitignore |
Define what to ignore at commit time. |
CHANGELOG.md |
List of changes to the sample. |
CONTRIBUTING.md |
Guidelines for contributing to the ADServiceAccountManager. |
README.md |
This README file. |
SECURITY.md |
This README file. |
LICENSE |
The license for the ADServiceAccountManager. |
There is over 6000 lines of Powershell code 😆
- Create new Group Managed Service Accounts (gMSA).
- Remove existing gMSA.
- Assign and remove Service Principal Names (SPNs) to gMSA.
- Add and remove gMSA from Active Directory groups.
- Modify gMSA attributes.
- Create new Standard Accounts (SSA).
- Remove existing Standard Accounts (SSA).
- Add and remove Standard Accounts (SSA) from Active Directory groups.
- Modify Standard Service Account attributes.
- Migrate Standard Accounts (SSA) to gMSA.
- Information about connected Active Directory:
- Check for SYSVOL type (FRS or DFRS).
- Check for Enabled users.
- Check for stale user objects not logged in the last 30, 60, or 90 days.
- Check for stale computer objects not logged in the last 30, 60, or 90 days.
- Check for Tombstone Lifetime.
- Check for when Active Directory is created.
- Check for if and where an Azure AD Connect is installed.
- Check for UPN suffixes.
- Check for Trusts.
- Check for Exchange Server(s) in the domain.
- Information about where FSMO Roles are in the domain (server names).
- Domain functions and levels.
- Domain Objects (like users, computers, and groups).
- Check if Microsoft Group Key Distribution Service (KdsSvc) is installed in Active Directory.
- ...
- Export data from the domain information page to .csv.
- Export stale objects from the domain information page to .csv.
- Access a dynamic name for the export file of .csv for GMSA and SSA accounts.
To be continued...
This tool offers an extensive set of features that cater to the needs of administrators, making it an indispensable resource for managing service accounts in an Active Directory environment.
- None
To run the AD ServiceAccount Manager, you will need:
- Windows PowerShell 5.1 or later
- The Active Directory module installed on your system
- The appropriate permissions to create and manage service accounts in Active Directory
To use remote features in AD ServiceAccount Manager (such as checking if service accounts are used, or installing/uninstalling a gMSA account on remote servers), the following protocols and features must be enabled and configured on both the management and target computers:
-
WinRM (Windows Remote Management)
- WinRM must be enabled and running on all remote computers.
- By default, WinRM listens on HTTP (port 5985) and optionally HTTPS (port 5986).
-
PowerShell Remoting
- PowerShell Remoting must be enabled (
Enable-PSRemoting -Force
). - The user running the command must have permission to connect remotely (typically a member of the Administrators group on the target machine, or configured via
Set-PSSessionConfiguration
).
- PowerShell Remoting must be enabled (
-
Network Connectivity
- TCP port 5985 (HTTP) or 5986 (HTTPS) must be open between the management host and the target computers.
- Firewalls must allow inbound connections on these ports.
-
Kerberos Authentication
- For domain-joined computers, Kerberos is used for authentication by default.
- Both the management host and target computers must be in the same or trusted domains.
-
Remote Management Exceptions
- The target computer’s firewall must allow "Windows Remote Management" (can be enabled via
Enable-PSRemoting
).
- The target computer’s firewall must allow "Windows Remote Management" (can be enabled via
-
CredSSP or HTTPS
- For passing credentials or running commands that require credential delegation, configure CredSSP or use HTTPS for WinRM.
-
Active Directory Module
- The Active Directory module should be available on the management host for AD-related cmdlets.
Example: Enable Remoting on Target Computer
Enable-PSRemoting -Force
Example: Open Firewall for WinRM
Set-NetFirewallRule -Name 'WINRM-HTTP-In-TCP' -Enabled True
Summary
You need WinRM enabled, PowerShell Remoting configured, open network ports (5985/5986), proper authentication (Kerberos), and firewall rules allowing remote management. Both management and target computers should be domain-joined for seamless Kerberos authentication.
For changes, PowerShell Studio is it for now
You can either clone this repository and build the project yourself.
The AD ServiceAccount Manager GUI can be run as an elevated executable (preferred) or as a script. Below are the instructions to load as a script.
- Log into a Domain Controller, in the domain where the service account will be created
- Open PowerShell as Administrator
- Navigate to the folder where the script is located
- Run the following command:
.\ADServiceAccountManager.ps1
Or run executable:
.\ADServiceAccountManager v. x.x.x.x - Build at xxxxxxxx-xxxxxx
🔧 How to Use
- Open the AD ServiceAccount Manager GUI
- Group Managed Service Accounts (gMSA)
- Standard Accounts (SSA)
-
In the AD ServiceAccount Manager GUI
- Select the Group Managed Accounts (gMSA) tab
- Click the Create New button
- Select the Group Managed Accounts (gMSA) tab
-
In the New Group Managed Service Account window that appears
- Type the Name of the new account
- NOTE: As you type, it is testing if an account exists with that name. If it does, it will recommend a new name.
- Type the Service Request # from HPSM or Service Now
- Type the Purpose of the service account
- Select or type the Functional Owner's Distribution Email Address
- Optional Uncommon Options:
- Modify the User Logon name (sAMAccountName) if needed
- Modify the auto-populated Description if needed
- Enable or Disable the account as required
- Modify the Encryption Types only if required
- Modify the Container to store the Managed Service Account
- This is not common
- Modify the DNS Host Name
- This is not common
- Click Create New Group Managed Service Account button to create the account
- NOTE: The button will be disabled if any field is not correct or needs attention.
- Type the Name of the new account
-
A success pop-up should appear, reminding you to run a command on the server that will be using the account - in the pop-up you have the option to install it automaticly if the access is possible (permissions and network/firewall). - in the pop-up you have the option to install it automaticly if the access is possible (permissions and network/firewall).
- Click OK
- In the AD ServiceAccount Manager GUI
- Select the Group Managed Accounts (gMSA) tab
- Select the Account from the Group Managed Service Account List
- Right click the Account, and click the Remove menu item
- In the Confirm pop-up, type the name of the account exactly as shown
- Click OK to immediately (and irreversibly) delete the account
- In the AD ServiceAccount Manager GUI
- Select the Group Managed Accounts (gMSA) tab
- Select the Account from the Group Managed Service Account List
- In the bottom right, select the Service Principal Names (SPNs) tab
- Type the SPN that you would like to add, to the Add SPN textbox
- Click Add to add the SPN immediately to the account
- Repeat to add additional SPNs
- In the AD ServiceAccount Manager GUI
- Select the Group Managed Accounts (gMSA) tab
- Select the Account from the Group Managed Service Account List
- In the bottom right, select the Service Principal Names (SPNs) tab
- Select the SPN that you would like to remove
- Click the Remove button
- At the confirmation pop-up, select Yes to remove the SPN immediately
- In the AD ServiceAccount Manager GUI
- Select the Group Managed Accounts (gMSA) tab
- Select the Account from the Group Managed Service Account List
- In the bottom right, select the Assigned Computers tab
- Click the Add button
- In the AD Object Picker pop up
- Select the Type (either Computer or Group)
- Type the Name (or partial name) of the Computer or Group
- Select the Check Name button
- In the table, select the Computer or Group to assign the gMSA to
- Click the Select button to immediately assign the Computer or Group to the gMSA
- In the AD ServiceAccount Manager GUI
- Select the Group Managed Accounts (gMSA) tab
- Select the Account from the Group Managed Service Account List
- In the bottom right, select the Service Principal Names (SPNs) tab
- Select the SPN that you would like to remove
- Click the Remove button, to remove the assigned computer immediately (it´s checks for if any services are running as the account if possible)
- In the AD ServiceAccount Manager GUI
- Select the Group Managed Accounts (gMSA) tab
- Select the Account from the Group Managed Service Account List
- In the bottom right, select the Member Of tab
- Click Add
- In the AD Object Picker pop up
- Type the Name (or partial name) of the Group
- Select the Check Name button
- In the table, select the Group to add the gMSA to
- Click the Select button to immediately add the gMSA to the selected group.
- In the AD ServiceAccount Manager GUI
- Select the Group Managed Accounts (gMSA) tab
- Select the Account from the Group Managed Service Account List
- In the bottom right, select the Member Of tab
- Select the Group that you would like to remove
- Click the Remove button
- At the confirmation pop-up, select Yes to remove the gMSA from the AD Group immediately
- In the AD ServiceAccount Manager GUI
- Select the Group Managed Accounts (gMSA) tab
- Select the Account from the Group Managed Service Account List
- In the bottom left, modify the selected attribute(s)
- Any pending changes will change to a Green font
- Click Apply , to apply the pending changes.
- NOTE: If you add an Encryption Type other than AES256, you will be required to type in a phrase exactly (case-sensitive), to verify you want to select an unsafe encryption type
- In the AD ServiceAccount Manager GUI
- Select the Standard Accounts (SSA) tab
- Click the Create New button
- Select the Standard Accounts (SSA) tab
- In the New Standard Service Account window that appears
- Type the Name of the new account
- NOTE: As you type, it is testing if an account exists with that name. If it does, it will recommend a new name.
- Type the Service Request # from HPSM or Service Now
- Type the Purpose of the service account
- Either type in a password , or click the Generate button to create random 25 Character Password
- Save this password, as it will not be available again after account creation
- Select or type the Functional Owner's Distribution Email Address
- Optional Uncommon Options:
- Modify the User Logon name (sAMAccountName) if needed
- Modify the auto-populated Description if needed
- Enable or Disable the account as required
- This option is only available if added a password above
- Modify the Encryption Types only if required
- Modify the password options and Account expiration as required
- Click Create New Standard Service Account button to create the account
- NOTE: The button will be disabled if any field is not correct or needs attention.
- A pop-up will appear to confirm you have saved the password (if created).
- Select Yes to continue; or select No to go back to save it
- A success pop-up should appear, reminding you to run a command on the server that will be using the account - in the pop-up you have the option to install it automaticly if the access is possible (permissions and network/firewall).
- Click OK
- Type the Name of the new account
- In the AD ServiceAccount Manager GUI
- Select the Standard Accounts (SSA) tab
- Select the Account from the Standard Service Account List
- Right click the Account, and click the Remove menu item
- In the Confirm pop-up, type the name of the account exactly as shown
- Click OK to immediately (and irreversibly) delete the account
- In the AD ServiceAccount Manager GUI
- Select the Standard Accounts (SSA) tab
- Select the Account from the Standard Service Account List
- In the bottom right, in the Member Of box
- Click Add
- In the AD Object Picker pop up
- Type the Name (or partial name) of the Group
- Select the Check Name button
- In the table, select the Group to add the Account to
- Click the Select button to immediately add the Account to the selected group.
- In the AD ServiceAccount Manager GUI
- Select the Standard Accounts (SSA) tab
- Select the Account from the Standard Service Account List
- In the bottom right, select the Member Of box
- Select the Group that you would like to remove
- Click the Remove button
- At the confirmation pop-up, select Yes to remove the Account from the AD Group immediately
- In the AD ServiceAccount Manager GUI
- Select the Standard Accounts (SSA) tab
- Select the Account from the Standard Service Account List
- In the bottom left, modify the selected attribute(s)
- Any pending changes will change to a Green font
- Click Apply , to apply the pending changes.
- NOTE: If you add an Encryption Type other than AES256, you will be required to type in a phrase exactly (case-sensitive), to verify you want to select an unsafe encryption type
- In the AD ServiceAccount Manager GUI
- Select the Standard Accounts (SSA) tab
- Select the Account from the Standard Service Account List
- Right click the Account, and click the Create a gMSA from [accountname] menu item
- In the New Group Managed Service Account window that appears
- The Name field will be pre-populated with the selected account name
- Type the Service Request # from HPSM or Service Now
- Type the Purpose of the service account
- Select or type the Functional Owner's Distribution Email Address
- Optional Uncommon Options:
- Modify the User Logon name (sAMAccountName) if needed
- Modify the auto-populated Description if needed
- Enable or Disable the account as required
- Modify the Encryption Types only if required
- Modify the Container to store the Managed Service Account
- This is not common
- Modify the DNS Host Name
- This is not common
- Click Create New Group Managed Service Account button to create the account
- NOTE: The button will be disabled if any field is not correct or needs attention.
- A success pop-up should appear, asking if you would like to add this gMSA account to the same groups that the Standard Service Account was in.
- Click Yes to add to the selected groups; Click No to not add to the selected Groups
- A success pop-up should appear, reminding you to run a command on the server that will be using the account - in the pop-up you have the option to install it automaticly if the access is possible (permissions and network/firewall).
- Click OK
If you want to contribute to this project, please open an issue or submit a pull request. I welcome contributions :)
See CONTRIBUTING for more information.
First off, thanks for taking the time to contribute! Contributions are what makes the open-source community such an amazing place to learn, inspire, and create. Any contributions you make will benefit everybody else and are greatly appreciated. Feel free to send pull requests or fill out issues when you encounter them. I'm also completely open to adding direct maintainers/contributors and working together! :)
Please try to create bug reports that are:
- Reproducible. Include steps to reproduce the problem.
- Specific. Include as much detail as possible: which version, what environment, etc.
- Unique. Do not duplicate existing opened issues.
- Scoped to a Single Bug. One bug per report.´´
The project is actively developed and updated.
Commercial support
This project is open-source and I invite everybody who can and will to contribute, but I cannot provide any support because I only created this as a "hobby project" ofc. with tbe best in mind. For commercial support, please contact me on LinkedIn so we can discuss the possibilities. It’s my choice to work on this project in my spare time, so if you have commercial gain from this project you should considering sponsoring me.
- ...
and many more posts and shareing online - check it out! ❤️
This project is licensed under the MIT License - see the LICENSE file for details.
See LICENSE for more information.