Skip to content

TechDirectArchive

Hands-on IT, Cloud, Security & DevOps Insights

  • Home
  • About
  • Advertise With US
  • Reviews
  • Contact
  • Toggle search form
Home » Scripts » How to create a KDS root key using PowerShell

How to create a KDS root key using PowerShell

Posted on 09/04/202009/10/2024 Christian By Christian No Comments on How to create a KDS root key using PowerShell
Group Managed Service Accounts

If you intend to use Group Managed Service Accounts (gMSAs) feature. You will have to create a root key for the group key distribution service within Active Directory. One great benefit is that the gMSA password management moves to the Windows operating system. In this article, we will discuss how to create a KDS root key using PowerShell. Please see How to reset MySQL Root password, how to Import certificates into Trusted Root and Personal certificate store, and Create and Delete Registry Keys via PowerShell in Windows.

Due to the complexity and length of gMSA passwords, the likelihood of brute force attacks is minimized. This is used by the KDS service in Domain Controllers to generate passwords. See this post where the Group Managed Service Account was required.

Here are some interesting guides you want to read: Post OS Installation configuration of Windows Server 2019 Properties, how to install Windows Server 2016 Operating System, how to install Windows Server 2019 on a VMware Workstation, and how to install and configure Ubuntu Linux.

Create a KDS root

Run the following PowerShell command as administrator privilege. You can check the if a root key exists by running the command below in PowerShell. You will also use this to verify the creation of a kds root key.

Get-KdsRootKey 

Note: Microsoft recommends to create only one root key per domain.

Example A

Run the below syntax below in order to create a KDS rook key.

Add-KdsRootKey -EffectiveImmediately (Get-Date).Addhours(-10)Effective Time Parameter

The date on which takes effect the newly generated root key. If this parameter is not specified, the default date set is 10 days after the current date.  

create KDS root key

Here is how to enable MFA on Root Account: Create a User on AWS and Register MFA, and “Connecting to the RDP host: Fix the Certificate could not be verified back to the root certificate“.

Example B

If you would like to use this key immediately, use the cmdlet below.

KDS root key

Effective Immediately Parameter: This command creates a new root key immediately but must wait up to 10 hours to be available. This is a safety measure to make sure all domain controllers have replicated and are ready to respond to gMSA requests. 

Note: To mitigate the wait time which is advisable only in a test environment. Please use the command below. This will ensure that the key is effective 10 hours before the time of creation.

Add-KdsRootKey -EffectiveTime ((get-date).addhours(-10)). 

To verify if this Key is created correctly, use the cmdlet below

  • Get-KdsRootKey 
  • Press Enter

Note: This can also be verified from Active Directory Sites and Services (dssite.msc) console.

FAQs

Can the krbtgt also be reset 10 hours behind similar to the creation of the KDS rootkey?

No, the KRBTGT account password reset cannot be backdated like the KDS root key using the Add-KdsRootKey -EffectiveImmediately (Get-Date).Addhours(-10) parameter.
The KRBTGT account password reset must be performed in real-time.

When you reset the KRBTGT account password, the Kerberos Key Distribution Center (KDC) uses the new password to issue and validate Ticket Granting Tickets (TGTs) moving forward. Unlike the KDS root key, which supports backdating for Distributed Key Generation Services, resetting the KRBTGT password has no option to specify an earlier effective time.

Kerberos tickets issued prior to the reset will still be validated using the previous KRBTGT password until they expire, and a second reset can be scheduled if needed to finalize the transition.

How can the kbrtgt be reset backward?

The KRBTGT account password cannot be reset backward in time. Kerberos does not support backdating when resetting the KRBTGT account password.

Once the KRBTGT password is reset, the change takes effect immediately, and all new Ticket Granting Tickets (TGTs) are issued using the new password. There is no mechanism in Active Directory to backdate or apply a past effective time to a KRBTGT password reset.

It is recommended to reset the KRBTGT password twice with a delay (usually hours or days) between the two resets. This ensures that tickets using the old password are phased out before the second reset.

However, I hope you found this blog post on how to create a KDS root key using PowerShell helpful. Furthermore, Please let me know in the comment session if you have any questions.

5/5 - (1 vote)

Thank you for reading this post. Kindly share it with others.

  • Share on X (Opens in new window) X
  • Share on Reddit (Opens in new window) Reddit
  • Share on LinkedIn (Opens in new window) LinkedIn
  • Share on Facebook (Opens in new window) Facebook
  • Share on Pinterest (Opens in new window) Pinterest
  • Share on Tumblr (Opens in new window) Tumblr
  • Share on Telegram (Opens in new window) Telegram
  • Share on WhatsApp (Opens in new window) WhatsApp
  • Share on Mastodon (Opens in new window) Mastodon
  • Share on Bluesky (Opens in new window) Bluesky
  • Share on Threads (Opens in new window) Threads
  • Share on Nextdoor (Opens in new window) Nextdoor
Scripts Tags:Microsoft Windows, PowerShell, Windows 10, Windows 11, Windows Server 2016

Post navigation

Previous Post: Post-Deployment of Active Directory Federation Service (ADFS)
Next Post: Create a self-signed certificate and export it in PFX format via PowerShell [Part 1]

Related Posts

  • windows powershell thumbnail
    Unable to uninstall AppX? How to uninstall builtin programs using PowerShell in Windows 10 Scripts
  • Featured image batch file.
    Retrieve Recent Windows Update: How to create batch script files Scripts
  • S3 Bucket
    Access AWS Management Console and Create Resources with AWS CLI on Windows AWS/Azure/OpenShift
  • Get certificate thumbprint
    Retrieve an SSL Thumbprint in Windows using PowerShell Scripts
  • hero activedirectory
    Create and find Organisation Unit paths in AD Scripts
  • powershell01
    WinRM and PSRemoting: Configure servers for remote access Scripts

More Related Articles

windows powershell thumbnail Unable to uninstall AppX? How to uninstall builtin programs using PowerShell in Windows 10 Scripts
Featured image batch file. Retrieve Recent Windows Update: How to create batch script files Scripts
S3 Bucket Access AWS Management Console and Create Resources with AWS CLI on Windows AWS/Azure/OpenShift
Get certificate thumbprint Retrieve an SSL Thumbprint in Windows using PowerShell Scripts
hero activedirectory Create and find Organisation Unit paths in AD Scripts
powershell01 WinRM and PSRemoting: Configure servers for remote access Scripts

Leave a Reply Cancel reply

You must be logged in to post a comment.

Microsoft MVP

VEEAMLEGEND

vexpert-badge-stars-5

Virtual Background

GoogleNews

Categories

veeaam100

Veeam Vanguard

  • diagnostic6
    How to enable and use Diagnostic Data Viewer on Windows Windows
  • feature image
    How to Configure Advanced PAM in Linux Linux
  • mendeley
    Install Mendeley Reference Manager and Cite for Word on Mac JIRA|Confluence|Apps
  • Trellix BitLocker and fileVault Recovery
    Selfservice Recovery: Trellix BitLocker and fileVault Recovery Security | Vulnerability Scans and Assessment
  • GNS3
    How to Connect GNS3 to the internet on Windows Network | Monitoring
  • Uninstall SQL Server 2025
    Uninstall Microsoft SQL Server 2025 from Windows Oracle/MSSQL/MySQL
  • Retieve BitLocker Recovery Keys from microsoft sql
    Get MBAM BitLocker Recovery Keys from Microsoft SQL Server Windows
  • Screenshot 2020 10 31 at 10.35.37
    How to set the PowerShell Execution Policy via Windows Registry Windows Server

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 1,814 other subscribers
  • RSS - Posts
  • RSS - Comments
  • About
  • Authors
  • Write for us
  • Advertise with us
  • General Terms and Conditions
  • Privacy policy
  • Feedly
  • Telegram
  • Youtube
  • Facebook
  • Instagram
  • LinkedIn
  • Tumblr
  • Pinterest
  • Twitter
  • mastodon

Tags

Active Directory Azure Bitlocker Microsoft Windows PowerShell WDS Windows 10 Windows 11 Windows Deployment Services Windows Server 2016

Copyright © 2025 TechDirectArchive

 

Loading Comments...
 

You must be logged in to post a comment.