<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Server Scripts</title>
    <description>The latest articles on DEV Community by Server Scripts (@srvscripts).</description>
    <link>https://dev.to/srvscripts</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4250802%2Fa6ff32a8-5942-4f3d-a90a-b922462b27dd.png</url>
      <title>DEV Community: Server Scripts</title>
      <link>https://dev.to/srvscripts</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/srvscripts"/>
    <language>en</language>
    <item>
      <title>Trust Relationship Failed: Fix Workstation Domain Problems</title>
      <dc:creator>Server Scripts</dc:creator>
      <pubDate>Wed, 18 Nov 2026 22:36:15 +0000</pubDate>
      <link>https://dev.to/srvscripts/trust-relationship-failed-fix-workstation-domain-problems-47b4</link>
      <guid>https://dev.to/srvscripts/trust-relationship-failed-fix-workstation-domain-problems-47b4</guid>
      <description>&lt;p&gt;&lt;strong&gt;Short answer:&lt;/strong&gt; Log on with a local administrator account, open an elevated PowerShell and run &lt;code&gt;Test-ComputerSecureChannel -Repair -Credential DOMAIN\admin&lt;/code&gt; to reset the machine password on both sides in one step. If that fails, run &lt;code&gt;Reset-ComputerMachinePassword -Server dc01 -Credential DOMAIN\admin&lt;/code&gt; and reboot. Rejoining the domain works too, but it is slower, generates a new SID for the computer object and can break group memberships and GPO links, so keep it as the fallback. &lt;em&gt;(Reviewed October 2026.)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F71omgiuoojtntoiepqg9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F71omgiuoojtntoiepqg9.png" alt="Trust Relationship Failed summary card: Log on with a local administrator account, open an elevated PowerShell and run Test-ComputerSecureChannel -Repair…" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In short: Log on with a local administrator account, open an elevated PowerShell and run Test-ComputerSecureChannel -Repair -Credential DOMAIN\admin to reset the machine password on both sides in one step.&lt;/p&gt;

&lt;h2&gt;
  
  
  Table of Contents
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Confirm it really is the secure channel&lt;/li&gt;
&lt;li&gt;Repair the secure channel in place&lt;/li&gt;
&lt;li&gt;Use Reset-ComputerMachinePassword when repair fails&lt;/li&gt;
&lt;li&gt;Stop it coming back&lt;/li&gt;
&lt;li&gt;Verify&lt;/li&gt;
&lt;li&gt;Trust relationship failed at a glance&lt;/li&gt;
&lt;li&gt;Frequently asked questions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The message appears at the logon screen when a Windows 10/11 client or a Windows Server 2019/2022/2025 member server can no longer authenticate its own computer account to a domain controller. Each computer has a machine password that rotates every 30 days by default; if the value stored locally and the value in Active Directory drift apart, the secure channel fails and only cached or local accounts can log on. The usual causes are restoring a VM snapshot or backup taken before a password change, cloning a machine without sysprep, a duplicate computer name, or someone resetting the computer object in AD.&lt;/p&gt;

&lt;h2&gt;
  
  
  Confirm it really is the secure channel
&lt;/h2&gt;

&lt;p&gt;Sign in with a local account, or disconnect the network cable and sign in with the last domain user, whose credentials are cached. Then check the channel state in an elevated PowerShell:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="nc"&gt;Test&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;ComputerSecureChannel&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Verbose&lt;/span&gt;
&lt;span class="n"&gt;nltest&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;sc_query&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;corp&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;example&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;com&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A result of &lt;code&gt;False&lt;/code&gt;, or an nltest status such as &lt;code&gt;ERROR_NO_TRUST_SAM_ACCOUNT&lt;/code&gt; or &lt;code&gt;ERROR_NO_LOGON_SERVERS&lt;/code&gt;, confirms the diagnosis. If nltest reports no logon servers, fix DNS and connectivity first; the machine may simply be unable to reach a DC, and repairing the password will not help. Check that the client’s DNS points only at domain controllers and that &lt;code&gt;nslookup -type=SRV _ldap._tcp.dc._msdcs.corp.example.com&lt;/code&gt; returns records.&lt;/p&gt;

&lt;h2&gt;
  
  
  Repair the secure channel in place
&lt;/h2&gt;

&lt;p&gt;The repair option reads the current computer account in AD and resets the password on both sides:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="nc"&gt;Test&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;ComputerSecureChannel&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Repair&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Credential&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Get&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Credential&lt;/span&gt; &lt;span class="no"&gt;CORP&lt;/span&gt;\&lt;span class="n"&gt;adminuser&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Use a domain account that has “Reset password” rights on the computer object, which any Domain Admin or a delegated helpdesk group will have. When the command returns &lt;code&gt;True&lt;/code&gt;, reboot and sign in with a domain account. If it returns an access denied error, the computer object may be disabled or missing. Check with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="nc"&gt;Get&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;ADComputer&lt;/span&gt; &lt;span class="no"&gt;PC&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="no"&gt;FINANCE&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;07&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Properties&lt;/span&gt; &lt;span class="nc"&gt;Enabled&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;PasswordLastSet&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;LastLogonDate&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Re-enable it with &lt;code&gt;Enable-ADAccount&lt;/code&gt; if needed. If the object was deleted, restore it from the &lt;a href="https://srvscripts.com/guides/enable-active-directory-recycle-bin/" rel="noopener noreferrer"&gt;Active Directory Recycle Bin&lt;/a&gt; rather than recreating it, so the SID and memberships survive.&lt;/p&gt;

&lt;h2&gt;
  
  
  Use Reset-ComputerMachinePassword when repair fails
&lt;/h2&gt;

&lt;p&gt;This cmdlet writes a fresh password directly against a named DC, which avoids replication delays across sites:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="nc"&gt;Reset&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;ComputerMachinePassword&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Server&lt;/span&gt; &lt;span class="n"&gt;dc01&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;corp&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;example&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;com&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Credential&lt;/span&gt; &lt;span class="no"&gt;CORP&lt;/span&gt;\&lt;span class="n"&gt;adminuser&lt;/span&gt;
&lt;span class="nc"&gt;Restart&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Computer&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On older systems without the AD PowerShell module the equivalent is &lt;code&gt;netdom resetpwd /server:dc01 /userd:CORP\adminuser /passwordd:*&lt;/code&gt;. Both commands require the machine to reach the DC on TCP 445 and 135, so a host firewall or a VPN client that only allows DNS traffic will make them fail with an RPC error.&lt;/p&gt;

&lt;h2&gt;
  
  
  Stop it coming back
&lt;/h2&gt;

&lt;p&gt;If the same machine breaks repeatedly, find the reason rather than repeating the repair:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Snapshots: on VMware and Hyper-V, revert-to-snapshot restores an old machine password. Either avoid keeping snapshots for more than 30 days or disable the rotation on lab machines with the GPO Computer Configuration » Policies » Windows Settings » Security Settings » Local Policies » Security Options » “Domain member: Disable machine account password changes”.&lt;/li&gt;
&lt;li&gt;Cloning: run &lt;code&gt;sysprep /generalize&lt;/code&gt; before cloning, or every clone shares one computer SID and account.&lt;/li&gt;
&lt;li&gt;Duplicate names: two machines with the same name overwrite each other’s password. Rename one.&lt;/li&gt;
&lt;li&gt;Backup restores of a DC: a DC restored from an image older than the tombstone lifetime causes USN rollback (Event ID 2095), which breaks trust on many machines at once; see &lt;a href="https://srvscripts.com/guides/ad-replication-error-1722-8453/" rel="noopener noreferrer"&gt;fix AD replication errors 8453 and 1722&lt;/a&gt; for the wider checks.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The rotation interval itself is controlled by the “Domain member: Maximum machine account password age” policy, 30 days by default. Do not extend it as a workaround unless the environment genuinely needs long-lived snapshots.&lt;/p&gt;

&lt;h2&gt;
  
  
  Verify
&lt;/h2&gt;

&lt;p&gt;Log on as a domain user without the cable unplugged, then run &lt;code&gt;Test-ComputerSecureChannel&lt;/code&gt; again and expect &lt;code&gt;True&lt;/code&gt;. On the DC, check the computer object shows a fresh &lt;code&gt;PasswordLastSet&lt;/code&gt; value and that Event ID 5723 or 5805 (NETLOGON failures) no longer appear in the System log.&lt;/p&gt;

&lt;h2&gt;
  
  
  Trust relationship failed at a glance
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fnas859j7guskj4moq15i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fnas859j7guskj4moq15i.png" alt="Trust Relationship Failed – questions answered" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Trust Relationship Failed: the questions this guide answers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Official documentation:&lt;/strong&gt; &lt;a href="https://learn.microsoft.com/en-us/windows-server/identity/ad-ds/active-directory-domain-services" rel="noopener noreferrer"&gt;Active Directory Domain Services docs&lt;/a&gt;, &lt;a href="https://learn.microsoft.com/en-us/windows-server/" rel="noopener noreferrer"&gt;Windows Server documentation&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Related guides:&lt;/strong&gt; &lt;a href="https://srvscripts.com/guides/raise-ad-functional-level/" rel="noopener noreferrer"&gt;Raise the AD forest and domain functional level safely&lt;/a&gt; · &lt;a href="https://srvscripts.com/guides/ad-account-lockout-source-event-4740/" rel="noopener noreferrer"&gt;How to find the source of Active Directory account lockouts (Event ID 4740)&lt;/a&gt; · &lt;a href="https://srvscripts.com/guides/pdc-emulator-ntp-time-sync/" rel="noopener noreferrer"&gt;Configure NTP time sync for the PDC emulator and domain clients&lt;/a&gt;.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://srvscripts.com/guides/trust-relationship-failed-fix/" rel="noopener noreferrer"&gt;srvScripts&lt;/a&gt; — tested how-to guides and free tools for people who run servers.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>windows</category>
      <category>sysadmin</category>
      <category>activedirectory</category>
    </item>
    <item>
      <title>DirectAdmin DOCROOT Token Change in 1.710: Fix Custom Templates (Tested)</title>
      <dc:creator>Server Scripts</dc:creator>
      <pubDate>Wed, 18 Nov 2026 22:36:14 +0000</pubDate>
      <link>https://dev.to/srvscripts/directadmin-docroot-token-change-in-1710-fix-custom-templates-tested-k6c</link>
      <guid>https://dev.to/srvscripts/directadmin-docroot-token-change-in-1710-fix-custom-templates-tested-k6c</guid>
      <description>&lt;p&gt;&lt;strong&gt;Short answer:&lt;/strong&gt; Since DirectAdmin 1.710, &lt;code&gt;|DOCROOT|&lt;/code&gt; is the document-root token for domains and subdomains. &lt;code&gt;|SDOCROOT|&lt;/code&gt; still works, but &lt;code&gt;|REALDOCROOT|&lt;/code&gt; and &lt;code&gt;|PUB_DOCROOT|&lt;/code&gt; were removed and are now left in the config as literal text. On Apache that produced only a warning and a 404 for the affected virtual host, not a failed start. Find leftovers with &lt;code&gt;grep -nE '\|[A-Z_]+\|'&lt;/code&gt; on the generated httpd.conf files, replace the old tokens with &lt;code&gt;|DOCROOT|&lt;/code&gt; in your custom templates, and rewrite one user first. &lt;em&gt;(Reviewed October 2026.)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fyrjja0zsdgjaouxva4dx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fyrjja0zsdgjaouxva4dx.png" alt="DirectAdmin 1.710 DOCROOT Token Change: Fix Custom Templates (Tested) summary card: Since DirectAdmin 1.710, |DOCROOT| is the document-root token for domains and subdomains. |SDOCROOT| still works, but |R…" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In short: Since DirectAdmin 1.710, |DOCROOT| is the document-root token for domains and subdomains. |SDOCROOT| still works, but |REALDOCROOT| and |PUB_DOCROOT| were removed and are now left in the con…&lt;/p&gt;

&lt;p&gt;DirectAdmin 1.710 simplified the document-root tokens (the DirectAdmin DOCROOT token change) in the web server templates and, in the same release, stopped giving subdomains an automatic &lt;code&gt;www.&lt;/code&gt; alias. Stock templates were updated for you. Custom templates and custom HTTPD entries were not. We rendered each old token through a custom template on a DirectAdmin 1.712 test server and recorded exactly what Apache received.&lt;/p&gt;

&lt;h2&gt;
  
  
  Table of Contents
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;What changed&lt;/li&gt;
&lt;li&gt;What each old token renders on 1.712&lt;/li&gt;
&lt;li&gt;Find affected templates and entries&lt;/li&gt;
&lt;li&gt;Fix the templates&lt;/li&gt;
&lt;li&gt;Rewrite one user, then everyone&lt;/li&gt;
&lt;li&gt;Also check hooks, plugins and private_html&lt;/li&gt;
&lt;li&gt;Verify&lt;/li&gt;
&lt;li&gt;How we tested&lt;/li&gt;
&lt;li&gt;Frequently asked questions&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What changed
&lt;/h2&gt;

&lt;p&gt;The &lt;a href="https://docs.directadmin.com/changelog/version-1.710.html" rel="noopener noreferrer"&gt;DirectAdmin 1.710 changelog&lt;/a&gt; lists three token changes and one behaviour change:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;|DOCROOT|&lt;/code&gt; is now used for both domains and subdomains. Subdomain templates previously used a different token.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;|SDOCROOT|&lt;/code&gt; is still available.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;|REALDOCROOT|&lt;/code&gt; and &lt;code&gt;|PUB_DOCROOT|&lt;/code&gt; are removed completely.&lt;/li&gt;
&lt;li&gt;Subdomains no longer get an automatic &lt;code&gt;www.sub.example.com&lt;/code&gt; alias. That is covered separately in &lt;a href="https://srvscripts.com/guides/directadmin-subdomain-www-not-working/" rel="noopener noreferrer"&gt;www.sub.example.com not working after 1.710&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What each old token renders on 1.712
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Token in a custom template&lt;/th&gt;
&lt;th&gt;What ended up in httpd.conf&lt;/th&gt;
&lt;th&gt;Effect&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;`&lt;/td&gt;
&lt;td&gt;DOCROOT&lt;/td&gt;
&lt;td&gt;`&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;`&lt;/td&gt;
&lt;td&gt;SDOCROOT&lt;/td&gt;
&lt;td&gt;`&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;`&lt;/td&gt;
&lt;td&gt;REALDOCROOT&lt;/td&gt;
&lt;td&gt;`&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;`&lt;/td&gt;
&lt;td&gt;PUB_DOCROOT&lt;/td&gt;
&lt;td&gt;`&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;So a broken template does not stop Apache. It quietly breaks only the virtual hosts built from that template. In our test the HTTP subdomain returned 404 while its HTTPS version, built from a different template, kept working, which is exactly the kind of fault that goes unnoticed for days.&lt;/p&gt;

&lt;h2&gt;
  
  
  Find affected templates and entries
&lt;/h2&gt;

&lt;p&gt;Custom virtual host templates live in &lt;code&gt;/usr/local/directadmin/data/templates/custom/&lt;/code&gt;; per-domain custom HTTPD and nginx entries are stored next to each domain’s config. Search both for the removed tokens:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;grep -rnE &lt;span class="s1"&gt;'REALDOCROOT|PUB_DOCROOT|SDOCROOT'&lt;/span&gt; /usr/local/directadmin/data/templates/custom/ 2&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;/dev/null
grep -lE &lt;span class="s1"&gt;'REALDOCROOT|PUB_DOCROOT|SDOCROOT'&lt;/span&gt; /usr/local/directadmin/data/users/*/domains/*.cust_* 2&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;/dev/null
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then check the generated configs for any token that was not replaced. On a clean server this prints nothing; the stock 1.712 templates only contain &lt;code&gt;|DOCROOT|&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;grep -nE &lt;span class="s1"&gt;'\|[A-Z_]+\|'&lt;/span&gt; /usr/local/directadmin/data/users/*/httpd.conf
grep -nE &lt;span class="s1"&gt;'\|[A-Z_]+\|'&lt;/span&gt; /usr/local/directadmin/data/users/*/nginx.conf 2&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;/dev/null
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Fix the templates
&lt;/h2&gt;

&lt;p&gt;Copy each custom template aside, compare it with the current stock template, and replace the removed tokens. The &lt;code&gt;sed&lt;/code&gt; line only runs if the backup copy was written; &lt;code&gt;diff&lt;/code&gt; exits 1 when the files differ, which is normal here, and 2 only for an error such as a missing file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; /usr/local/directadmin/data/templates
&lt;span class="nv"&gt;f&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;virtual_host2_sub.conf&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="nv"&gt;b&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$(&lt;/span&gt;mktemp /root/&lt;span class="nv"&gt;$f&lt;/span&gt;.bak-&lt;span class="nv"&gt;$(&lt;/span&gt;date +%F&lt;span class="o"&gt;)&lt;/span&gt;.XXXXXX&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"backup: $b"&lt;/span&gt;
diff -u &lt;span class="nv"&gt;$f&lt;/span&gt; custom/&lt;span class="nv"&gt;$f&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"diff exit $? (0 same, 1 different, 2 error)"&lt;/span&gt;
cp -a custom/&lt;span class="nv"&gt;$f&lt;/span&gt; &lt;span class="nv"&gt;$b&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; cmp -s custom/&lt;span class="nv"&gt;$f&lt;/span&gt; &lt;span class="nv"&gt;$b&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; \
  sed -i &lt;span class="s1"&gt;'s/|REALDOCROOT|/|DOCROOT|/g; s/|PUB_DOCROOT|/|DOCROOT|/g'&lt;/span&gt; custom/&lt;span class="nv"&gt;$f&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"backup failed, template not changed"&lt;/span&gt;
grep -nE &lt;span class="s1"&gt;'REALDOCROOT|PUB_DOCROOT'&lt;/span&gt; custom/&lt;span class="nv"&gt;$f&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"no removed tokens left"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Leave &lt;code&gt;|SDOCROOT|&lt;/code&gt; alone only if you depend on it meaning “the standard path even when a custom document root is set”; otherwise change it to &lt;code&gt;|DOCROOT|&lt;/code&gt; as well, so there is one token to reason about. If the diff shows that the stock template now does everything your custom copy was for, delete the custom copy instead: every custom template is one more file to check at the next template change.&lt;/p&gt;

&lt;h2&gt;
  
  
  Rewrite one user, then everyone
&lt;/h2&gt;

&lt;p&gt;Rewrite a single user first. The task regenerates only that user’s config and queues a graceful Apache reload, which ran about a minute later on our server; check the result before it does:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;da taskq --run &lt;span class="s2"&gt;"action=rewrite&amp;amp;value=httpd&amp;amp;user=USER"&lt;/span&gt;
grep -nE &lt;span class="s1"&gt;'\|[A-Z_]+\|'&lt;/span&gt; /usr/local/directadmin/data/users/USER/httpd.conf &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"no tokens left"&lt;/span&gt;
httpd -t &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; systemctl reload httpd
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each run writes a new backup file, so running the block twice keeps the original copy; note the path printed after &lt;code&gt;backup:&lt;/code&gt;. To undo, copy that file back and rewrite the same way:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;cp -a /root/virtual_host2_sub.conf.bak-YYYY-MM-DD.XXXXXX /usr/local/directadmin/data/templates/custom/virtual_host2_sub.conf
da taskq --run &lt;span class="s2"&gt;"action=rewrite&amp;amp;value=httpd&amp;amp;user=USER"&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; httpd -t &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; systemctl reload httpd
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;httpd -t&lt;/code&gt; checks the whole Apache configuration, including every user’s include file; there is no reliable way to check one user’s file on its own. When the user is clean, rewrite all configs. This restarts Apache (2.8 seconds on our server):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;da build rewrite_confs
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Also check hooks, plugins and private_html
&lt;/h2&gt;

&lt;p&gt;Scripts in &lt;code&gt;/usr/local/directadmin/scripts/custom/&lt;/code&gt; and third-party plugins sometimes build paths themselves. Look for the removed tokens and for hard-coded &lt;code&gt;private_html&lt;/code&gt; paths: DirectAdmin 1.711 stopped creating &lt;code&gt;private_html&lt;/code&gt;, and none of the domains created on our 1.712 server had one.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;grep -rlnE &lt;span class="s1"&gt;'REALDOCROOT|PUB_DOCROOT|private_html'&lt;/span&gt; /usr/local/directadmin/scripts/custom/ /usr/local/directadmin/plugins/*/ 2&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;/dev/null
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Verify
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;grep -A3 &lt;span class="s1"&gt;'ServerName sub.example.com'&lt;/span&gt; /usr/local/directadmin/data/users/USER/httpd.conf &lt;span class="o"&gt;|&lt;/span&gt; grep DocumentRoot
curl -s -o /dev/null -w &lt;span class="s1"&gt;'%{http_code}\n'&lt;/span&gt; http://sub.example.com/
curl -s -o /dev/null -w &lt;span class="s1"&gt;'%{http_code}\n'&lt;/span&gt; https://sub.example.com/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Check HTTP and HTTPS separately, because they are built from different templates. Every DocumentRoot line should be a real path and both requests should return the site’s normal status code. To move a domain to a different folder on purpose, see &lt;a href="https://srvscripts.com/guides/directadmin-custom-document-root/" rel="noopener noreferrer"&gt;custom document root for one domain&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  How we tested
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Server: DirectAdmin 1.712 on AlmaLinux 9.8 with Apache 2.4 (CustomBuild), 19–20 October 2026.&lt;/li&gt;
&lt;li&gt;A custom &lt;code&gt;virtual_host2_sub.conf&lt;/code&gt; with its DocumentRoot set to each old token in turn, rendered with a per-user rewrite and checked with &lt;code&gt;httpd -t&lt;/code&gt;, the generated httpd.conf and HTTP/HTTPS requests; the same tokens printed from a custom HTTPD entry for a domain, its subdomain and an alias pointer.&lt;/li&gt;
&lt;li&gt;21 October 2026: the backup, diff, token replacement, rewrite and undo commands above re-run as published against a custom template containing &lt;code&gt;|REALDOCROOT|&lt;/code&gt;, including running the edit block twice: the first backup still held the original template.&lt;/li&gt;
&lt;li&gt;Not tested: nginx, OpenLiteSpeed and LiteSpeed templates (DirectAdmin’s changelog applies the change to all of them), and servers upgraded from versions before 1.710.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  DirectAdmin DOCROOT token at a glance
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fl3sfb95u2pjhdhfpot0b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fl3sfb95u2pjhdhfpot0b.png" alt="DirectAdmin DOCROOT Token – questions answered" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;DirectAdmin DOCROOT token change: the questions this guide answers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Official documentation:&lt;/strong&gt; &lt;a href="https://docs.directadmin.com/" rel="noopener noreferrer"&gt;DirectAdmin documentation&lt;/a&gt;, &lt;a href="https://man7.org/linux/man-pages/" rel="noopener noreferrer"&gt;Linux man pages&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Related guides:&lt;/strong&gt; &lt;a href="https://srvscripts.com/guides/directadmin-da-cli/" rel="noopener noreferrer"&gt;Using the da CLI: da update, da build, da config-set, da user and update channels&lt;/a&gt; · &lt;a href="https://srvscripts.com/guides/directadmin-removed-api-endpoints/" rel="noopener noreferrer"&gt;DirectAdmin removed legacy API endpoints in 2025–2026: what they were and their /api/ replacements&lt;/a&gt; · &lt;a href="https://srvscripts.com/guides/install-directadmin-almalinux-debian-13/" rel="noopener noreferrer"&gt;Installing DirectAdmin on AlmaLinux 9/10 and Debian 13 (modern license, web installer vs CLI)&lt;/a&gt;.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://srvscripts.com/guides/directadmin-docroot-token-1-710/" rel="noopener noreferrer"&gt;srvScripts&lt;/a&gt; — tested how-to guides and free tools for people who run servers.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>directadmin</category>
      <category>sysadmin</category>
      <category>linux</category>
    </item>
    <item>
      <title>Git Commands: 42 Everyday Commands with Examples</title>
      <dc:creator>Server Scripts</dc:creator>
      <pubDate>Wed, 18 Nov 2026 22:36:14 +0000</pubDate>
      <link>https://dev.to/srvscripts/git-commands-42-everyday-commands-with-examples-1p3</link>
      <guid>https://dev.to/srvscripts/git-commands-42-everyday-commands-with-examples-1p3</guid>
      <description>&lt;p&gt;&lt;strong&gt;Short answer:&lt;/strong&gt; The Git commands you use every day are &lt;code&gt;git status&lt;/code&gt;, &lt;code&gt;git add&lt;/code&gt;, &lt;code&gt;git commit&lt;/code&gt;, &lt;code&gt;git diff&lt;/code&gt; and &lt;code&gt;git log&lt;/code&gt; for local work, &lt;code&gt;git switch&lt;/code&gt; and &lt;code&gt;git merge&lt;/code&gt; for branches, and &lt;code&gt;git fetch&lt;/code&gt;, &lt;code&gt;git pull&lt;/code&gt; and &lt;code&gt;git push&lt;/code&gt; to share. To undo safely, use &lt;code&gt;git restore&lt;/code&gt; for files, &lt;code&gt;git reset&lt;/code&gt; only on commits nobody else has, &lt;code&gt;git revert&lt;/code&gt; for pushed commits, and &lt;code&gt;git push --force-with-lease&lt;/code&gt; instead of &lt;code&gt;--force&lt;/code&gt;. The tables give syntax, an example and key options for 42 commands. &lt;em&gt;(Reviewed October 2026.)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Every example below was run in a scratch repository with Git 2.43.0 on 9 October 2026. A local bare repository stood in for the remote URLs, and real hashes replaced placeholders such as &lt;code&gt;a1b2c3d&lt;/code&gt;. The current Git release is 2.56; all commands here work on any Git from 2.30 onwards.&lt;/p&gt;

&lt;h2&gt;
  
  
  Table of Contents
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Setup and config&lt;/li&gt;
&lt;li&gt;Starting a repository&lt;/li&gt;
&lt;li&gt;Everyday changes&lt;/li&gt;
&lt;li&gt;Branching and merging&lt;/li&gt;
&lt;li&gt;Remotes and sharing&lt;/li&gt;
&lt;li&gt;Inspecting history&lt;/li&gt;
&lt;li&gt;Undoing and fixing&lt;/li&gt;
&lt;li&gt;Safe undo: reset vs revert vs restore&lt;/li&gt;
&lt;li&gt;Git on servers&lt;/li&gt;
&lt;li&gt;Git Commands at a glance&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Setup and config
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;th&gt;What it does&lt;/th&gt;
&lt;th&gt;Syntax&lt;/th&gt;
&lt;th&gt;Example&lt;/th&gt;
&lt;th&gt;Useful options&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;git config&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Read or set settings for the repository, user or system&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git config [--global] &amp;lt;key&amp;gt; &amp;lt;value&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git config --global user.name "Ann Admin"&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;--global&lt;/code&gt;, &lt;code&gt;--list --show-origin&lt;/code&gt;, &lt;code&gt;--unset&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;git help&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Show the manual for a command or a guide&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git help &amp;lt;command&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git help push&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;-g&lt;/code&gt; (guides), &lt;code&gt;git push -h&lt;/code&gt; (short usage)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;git --version&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Print the installed Git version&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git --version&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git --version&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;--build-options&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;git check-ignore&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Show which &lt;code&gt;.gitignore&lt;/code&gt; rule matches a path&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git check-ignore -v &amp;lt;path&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git check-ignore -v logs/app.log&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;-v&lt;/code&gt;, &lt;code&gt;--no-index&lt;/code&gt;, &lt;code&gt;--stdin&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Worth setting once: &lt;code&gt;git config --global pull.ff only&lt;/code&gt;, so &lt;code&gt;git pull&lt;/code&gt; never creates surprise merge commits.&lt;/p&gt;

&lt;h2&gt;
  
  
  Starting a repository
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;th&gt;What it does&lt;/th&gt;
&lt;th&gt;Syntax&lt;/th&gt;
&lt;th&gt;Example&lt;/th&gt;
&lt;th&gt;Useful options&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;git init&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Create a new repository&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git init [&amp;lt;dir&amp;gt;]&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git init -b main app&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;-b &amp;lt;branch&amp;gt;&lt;/code&gt;, &lt;code&gt;--bare&lt;/code&gt; (server-side repository)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;git clone&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Copy a repository with its history&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git clone &amp;lt;url&amp;gt; [&amp;lt;dir&amp;gt;]&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git clone https://git.example.com/ops/app.git&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;--depth 1&lt;/code&gt;, &lt;code&gt;--branch &amp;lt;name&amp;gt;&lt;/code&gt;, &lt;code&gt;--recurse-submodules&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;git submodule&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Embed another repository at a fixed commit&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git submodule add &amp;lt;url&amp;gt; &amp;lt;path&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git submodule update --init --recursive&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;add&lt;/code&gt;, &lt;code&gt;update --init&lt;/code&gt;, &lt;code&gt;status&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;git worktree&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Check out a second branch in another directory&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git worktree add &amp;lt;path&amp;gt; [&amp;lt;branch&amp;gt;]&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git worktree add ../app-hotfix -b hotfix&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;list&lt;/code&gt;, &lt;code&gt;remove&lt;/code&gt;, &lt;code&gt;prune&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Everyday changes
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;th&gt;What it does&lt;/th&gt;
&lt;th&gt;Syntax&lt;/th&gt;
&lt;th&gt;Example&lt;/th&gt;
&lt;th&gt;Useful options&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;git status&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Staged, unstaged and untracked files&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git status&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git status -sb&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;-s&lt;/code&gt; (short), &lt;code&gt;-b&lt;/code&gt; (branch), &lt;code&gt;--ignored&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;git add&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Stage changes for the next commit&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git add &amp;lt;path&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git add nginx.conf&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;-p&lt;/code&gt; (pick hunks), &lt;code&gt;-A&lt;/code&gt; (everything), &lt;code&gt;-u&lt;/code&gt; (tracked only)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;git commit&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Record the staged changes&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git commit -m "&amp;lt;message&amp;gt;"&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git commit -m "Raise worker_connections to 4096"&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;-a&lt;/code&gt;, &lt;code&gt;--amend&lt;/code&gt;, &lt;code&gt;-v&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;git diff&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Show changes not yet committed&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git diff [--staged] [&amp;lt;path&amp;gt;]&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git diff --staged&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;--staged&lt;/code&gt;, &lt;code&gt;--stat&lt;/code&gt;, &lt;code&gt;--word-diff&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;git rm&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Delete a file and stage the deletion&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git rm &amp;lt;path&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git rm --cached .env&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;--cached&lt;/code&gt; (stop tracking, keep the file), &lt;code&gt;-r&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;git mv&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Move or rename and stage it&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git mv &amp;lt;old&amp;gt; &amp;lt;new&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git mv nginx.conf conf/nginx.conf&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;-n&lt;/code&gt; (dry run), &lt;code&gt;-f&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;git stash&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Shelve uncommitted work&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git stash push -m "&amp;lt;message&amp;gt;"&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git stash push -m "wip tuning"&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;list&lt;/code&gt;, &lt;code&gt;pop&lt;/code&gt;, &lt;code&gt;-u&lt;/code&gt; (include untracked)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;code&gt;git rm --cached&lt;/code&gt; stops tracking a file such as &lt;code&gt;.env&lt;/code&gt;, but the secret stays in earlier commits. If it was pushed, rotate the secret.&lt;/p&gt;

&lt;h2&gt;
  
  
  Branching and merging
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;th&gt;What it does&lt;/th&gt;
&lt;th&gt;Syntax&lt;/th&gt;
&lt;th&gt;Example&lt;/th&gt;
&lt;th&gt;Useful options&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;git branch&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;List, create, rename or delete branches&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git branch [&amp;lt;name&amp;gt;]&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git branch -vv&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;-d&lt;/code&gt;/&lt;code&gt;-D&lt;/code&gt;, &lt;code&gt;-m&lt;/code&gt; (rename), &lt;code&gt;--merged&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;git switch&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Change to another branch&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git switch &amp;lt;branch&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git switch -c feature/login&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;-c&lt;/code&gt; (create), &lt;code&gt;-&lt;/code&gt; (previous branch)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;git checkout&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Older command for branches and files; checking out a tag gives a detached HEAD&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git checkout &amp;lt;ref&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git checkout v1.2.0&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;-b&lt;/code&gt;, &lt;code&gt;-- &amp;lt;path&amp;gt;&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;git merge&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Join another branch into the current one&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git merge &amp;lt;branch&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git merge --no-ff feature/login&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;--no-ff&lt;/code&gt;, &lt;code&gt;--ff-only&lt;/code&gt;, &lt;code&gt;--abort&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;git rebase&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Replay your commits on top of another base&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git rebase &amp;lt;base&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git rebase main&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;-i&lt;/code&gt;, &lt;code&gt;--continue&lt;/code&gt;/&lt;code&gt;--abort&lt;/code&gt;, &lt;code&gt;--onto&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;git cherry-pick&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Copy one commit onto the current branch&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git cherry-pick &amp;lt;commit&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git cherry-pick -x a1b2c3d&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;-x&lt;/code&gt; (note the source), &lt;code&gt;-n&lt;/code&gt;, &lt;code&gt;--abort&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;git tag&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Name a commit, usually a release&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git tag -a &amp;lt;name&amp;gt; -m "&amp;lt;msg&amp;gt;"&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git tag -a v1.2.0 -m "Release 1.2.0"&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;-a&lt;/code&gt;, &lt;code&gt;-l "v1.*"&lt;/code&gt;, &lt;code&gt;-d&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Remotes and sharing
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;th&gt;What it does&lt;/th&gt;
&lt;th&gt;Syntax&lt;/th&gt;
&lt;th&gt;Example&lt;/th&gt;
&lt;th&gt;Useful options&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;git remote&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Manage remote names and URLs&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git remote add &amp;lt;name&amp;gt; &amp;lt;url&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git remote -v&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;add&lt;/code&gt;, &lt;code&gt;set-url&lt;/code&gt;, &lt;code&gt;remove&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;git fetch&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Download remote commits without touching your files&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git fetch [&amp;lt;remote&amp;gt;]&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git fetch --prune origin&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;--prune&lt;/code&gt;, &lt;code&gt;--all&lt;/code&gt;, &lt;code&gt;--tags&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;git pull&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Fetch, then integrate into the current branch&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git pull [&amp;lt;remote&amp;gt; &amp;lt;branch&amp;gt;]&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git pull --ff-only&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;--ff-only&lt;/code&gt;, &lt;code&gt;--rebase&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;git push&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Upload commits and tags&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git push &amp;lt;remote&amp;gt; &amp;lt;branch&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git push -u origin main&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;-u&lt;/code&gt;, &lt;code&gt;--tags&lt;/code&gt;, &lt;code&gt;--force-with-lease&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;git ls-remote&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;List a remote’s branches and tags without cloning&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git ls-remote &amp;lt;remote&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git ls-remote --tags origin&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;--heads&lt;/code&gt;, &lt;code&gt;--tags&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;git archive&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Export a tree as a tar or zip, without &lt;code&gt;.git&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git archive -o &amp;lt;file&amp;gt; &amp;lt;ref&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git archive --format=tar.gz --prefix=app/ -o ../app-v1.2.0.tar.gz v1.2.0&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;--format&lt;/code&gt;, &lt;code&gt;--prefix&lt;/code&gt;, &lt;code&gt;-o&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;git apply&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Apply a patch file to the working tree&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git apply &amp;lt;patch&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git apply --check ../fix.patch&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;--check&lt;/code&gt;, &lt;code&gt;--stat&lt;/code&gt;, &lt;code&gt;-R&lt;/code&gt; (reverse)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Inspecting history
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;th&gt;What it does&lt;/th&gt;
&lt;th&gt;Syntax&lt;/th&gt;
&lt;th&gt;Example&lt;/th&gt;
&lt;th&gt;Useful options&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;git log&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Commit history&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git log [&amp;lt;range&amp;gt;] [-- &amp;lt;path&amp;gt;]&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git log --oneline --graph --decorate -10&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;-p&lt;/code&gt;, &lt;code&gt;--since="2 weeks ago"&lt;/code&gt;, &lt;code&gt;--follow&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;git show&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;One commit with its diff, or a file at a revision&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git show &amp;lt;rev&amp;gt;[:&amp;lt;path&amp;gt;]&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git show v1.2.0:nginx.conf&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;--stat&lt;/code&gt;, &lt;code&gt;--name-only&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;git blame&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Last commit that changed each line&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git blame &amp;lt;file&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git blame -L 10,20 conf/nginx.conf&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;-L&lt;/code&gt;, &lt;code&gt;-w&lt;/code&gt;, &lt;code&gt;-C&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;git shortlog&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Commit counts per author&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git shortlog -sn &amp;lt;rev&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git shortlog -sne --since="1 month ago" HEAD&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;-s&lt;/code&gt;, &lt;code&gt;-n&lt;/code&gt;, &lt;code&gt;-e&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;git grep&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Search tracked files (or any revision)&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git grep &amp;lt;pattern&amp;gt; [&amp;lt;rev&amp;gt;]&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git grep -n "worker_connections"&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;-n&lt;/code&gt;, &lt;code&gt;-i&lt;/code&gt;, &lt;code&gt;-l&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;git describe&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Name a commit relative to the newest tag&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git describe [--tags]&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git describe --tags --always&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;--tags&lt;/code&gt;, &lt;code&gt;--always&lt;/code&gt;, &lt;code&gt;--dirty&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;git bisect&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Binary search for the commit that broke something&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git bisect start &amp;lt;bad&amp;gt; &amp;lt;good&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git bisect start HEAD v1.2.0&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;run &amp;lt;script&amp;gt;&lt;/code&gt;, &lt;code&gt;good&lt;/code&gt;/&lt;code&gt;bad&lt;/code&gt;, &lt;code&gt;reset&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;git ls-files&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;List tracked, modified or untracked files&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git ls-files&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git ls-files --others --exclude-standard&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;-o&lt;/code&gt;, &lt;code&gt;-m&lt;/code&gt;, &lt;code&gt;--exclude-standard&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Give &lt;code&gt;git shortlog&lt;/code&gt; a revision such as &lt;code&gt;HEAD&lt;/code&gt; in scripts and cron jobs: without one, and without a terminal, it reads a log from standard input and waits. Add &lt;code&gt;--follow&lt;/code&gt; to &lt;code&gt;git log -- &amp;lt;file&amp;gt;&lt;/code&gt; to keep the history from before a rename.&lt;/p&gt;

&lt;h2&gt;
  
  
  Undoing and fixing
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;th&gt;What it does&lt;/th&gt;
&lt;th&gt;Syntax&lt;/th&gt;
&lt;th&gt;Example&lt;/th&gt;
&lt;th&gt;Useful options&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;git restore&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Discard file changes or unstage them&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git restore [--staged] &amp;lt;path&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git restore --staged conf/nginx.conf&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;--staged&lt;/code&gt;, &lt;code&gt;--source=&amp;lt;rev&amp;gt;&lt;/code&gt;, &lt;code&gt;-p&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;git reset&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Move the branch to another commit; optionally unstage or discard&lt;/td&gt;
&lt;td&gt;`git reset [--soft&lt;/td&gt;
&lt;td&gt;--mixed&lt;/td&gt;
&lt;td&gt;--hard] `&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;git revert&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;New commit that undoes an earlier one&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git revert &amp;lt;commit&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git revert --no-edit HEAD&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;--no-edit&lt;/code&gt;, &lt;code&gt;-n&lt;/code&gt;, &lt;code&gt;-m 1&lt;/code&gt; (merge commits)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;git clean&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Delete untracked files&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git clean -n&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;git clean -nd&lt;/code&gt;, then &lt;code&gt;git clean -fd&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;-n&lt;/code&gt; (dry run), &lt;code&gt;-d&lt;/code&gt;, &lt;code&gt;-x&lt;/code&gt; (ignored files too)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;git reflog&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Where HEAD has pointed, including after resets&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git reflog [&amp;lt;ref&amp;gt;]&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git reflog -5&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;show &amp;lt;branch&amp;gt;&lt;/code&gt;, &lt;code&gt;-n&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Safe undo: reset vs revert vs restore
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Situation&lt;/th&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;th&gt;Safe after push?&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Throw away edits to one file&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git restore conf/nginx.conf&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Yes (nothing committed)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Unstage a file, keep the edits&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git restore --staged conf/nginx.conf&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Bring back a file from a release&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git restore --source=v1.2.0 nginx.conf&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Undo the last commit, keep its changes staged&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git reset --soft HEAD~1&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;No: rewrites history&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Fix the last commit’s message or content&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git commit --amend&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;No: rewrites history&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Undo a commit that is already pushed&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git revert &amp;lt;commit&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Yes: adds a new commit&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Recover after &lt;code&gt;reset --hard&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;git reflog&lt;/code&gt;, then &lt;code&gt;git reset --hard HEAD@{1}&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Local rescue&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;reset&lt;/strong&gt; moves the branch pointer: &lt;code&gt;--soft&lt;/code&gt; keeps changes staged, &lt;code&gt;--mixed&lt;/code&gt; unstaged, and &lt;code&gt;--hard&lt;/code&gt; also deletes uncommitted work, which reflog cannot recover. &lt;strong&gt;revert&lt;/strong&gt; adds an opposite commit, so it is the safe undo on a shared branch. &lt;strong&gt;restore&lt;/strong&gt; works on files, not commits.&lt;/p&gt;

&lt;p&gt;When you must overwrite a remote branch after a rebase or amend, use &lt;code&gt;git push --force-with-lease&lt;/code&gt;. It refuses if the remote branch has moved since your last fetch. In the test, a teammate’s push made it fail with &lt;code&gt;(stale info)&lt;/code&gt;, where &lt;code&gt;--force&lt;/code&gt; would have deleted their commit. A background &lt;code&gt;git fetch&lt;/code&gt;, for example from an IDE, defeats that check; adding &lt;code&gt;--force-if-includes&lt;/code&gt; (Git 2.30+) still rejected the push. Then run &lt;code&gt;git pull --rebase&lt;/code&gt; and push again.&lt;/p&gt;

&lt;h2&gt;
  
  
  Git on servers
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;For server admins:&lt;/strong&gt; Git works well for versioning &lt;code&gt;/etc&lt;/code&gt; and deploying configuration.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Task&lt;/th&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Deploy only fast-forward updates&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;git pull --ff-only&lt;/code&gt; (fails instead of merging if someone edited files on the server)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;See what a deploy would change&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;git fetch origin&lt;/code&gt;, then &lt;code&gt;git diff HEAD origin/main --stat&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ship a release without &lt;code&gt;.git&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git archive --format=tar.gz -o app.tar.gz v1.2.0&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Check for local edits before deploying&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;git status --porcelain&lt;/code&gt; (empty output means clean)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Repository owned by another user&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;git config --global --add safe.directory /srv/app&lt;/code&gt; after checking who owns it&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Keep secrets in &lt;code&gt;.gitignore&lt;/code&gt; (confirm with &lt;code&gt;git check-ignore -v&lt;/code&gt;), and never let the web server serve a &lt;code&gt;.git&lt;/code&gt; directory: anyone could download the history and any committed secrets.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Official documentation (checked 9 October 2026):&lt;/strong&gt; &lt;a href="https://git-scm.com/docs" rel="noopener noreferrer"&gt;Git reference documentation&lt;/a&gt; · &lt;a href="https://git-scm.com/docs/git-reset" rel="noopener noreferrer"&gt;git-reset&lt;/a&gt; · &lt;a href="https://git-scm.com/docs/git-restore" rel="noopener noreferrer"&gt;git-restore&lt;/a&gt; · &lt;a href="https://git-scm.com/docs/git-revert" rel="noopener noreferrer"&gt;git-revert&lt;/a&gt; · &lt;a href="https://git-scm.com/docs/git-push" rel="noopener noreferrer"&gt;git-push (--force-with-lease)&lt;/a&gt; · &lt;a href="https://git-scm.com/book/en/v2" rel="noopener noreferrer"&gt;Pro Git book&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Git Commands at a glance
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fvtvgctilrydhyvth471b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fvtvgctilrydhyvth471b.png" alt="Git Commands – short answer" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In short: A reference of 42 everyday Git commands grouped by task, each with its syntax, a tested example and the most useful options, plus safe ways to undo mistakes.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxfyaujrs1w4n0ei9ymtk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxfyaujrs1w4n0ei9ymtk.png" alt="Git Commands – what this guide covers" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Git Commands: what this guide covers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Related:&lt;/strong&gt; &lt;a href="https://srvscripts.com/guides/git-cheat-sheet/" rel="noopener noreferrer"&gt;Git Cheat Sheet: Branches, Undo, Remotes and Deploys&lt;/a&gt; · &lt;a href="https://srvscripts.com/tools/gitignore-generator/" rel="noopener noreferrer"&gt;.gitignore Generator&lt;/a&gt; · &lt;a href="https://srvscripts.com/guides/terminal-cheat-sheet/" rel="noopener noreferrer"&gt;Terminal Shortcuts Cheat Sheet: Bash, Zsh and tmux&lt;/a&gt;.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://srvscripts.com/guides/git-commands/" rel="noopener noreferrer"&gt;srvScripts&lt;/a&gt; — tested how-to guides and free tools for people who run servers.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>git</category>
      <category>sysadmin</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Install RSAT on Windows 11: 5 Methods, Including Offline</title>
      <dc:creator>Server Scripts</dc:creator>
      <pubDate>Wed, 18 Nov 2026 02:25:54 +0000</pubDate>
      <link>https://dev.to/srvscripts/install-rsat-on-windows-11-5-methods-including-offline-1p3a</link>
      <guid>https://dev.to/srvscripts/install-rsat-on-windows-11-5-methods-including-offline-1p3a</guid>
      <description>&lt;p&gt;To install RSAT on Windows 11, you add the Remote Server Administration Tools as Features on Demand through Settings, PowerShell or DISM; there is no separate download any more. RSAT gives you Active Directory Users and Computers, Group Policy Management, DNS, DHCP, Failover Cluster Manager and the matching PowerShell modules on your admin workstation, so you can manage Windows Server 2016 to 2025 without signing in to the servers. This guide covers every method, the WSUS error 0x800f0954, offline installation, ARM64 devices, verification, removal and the Windows Server equivalents.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Short answer:&lt;/strong&gt; Open PowerShell as administrator and run &lt;code&gt;Get-WindowsCapability -Name RSAT* -Online | Where-Object State -eq 'NotPresent' | Add-WindowsCapability -Online&lt;/code&gt; to install all RSAT tools, or pick them in &lt;strong&gt;Settings » System » Optional features » View features&lt;/strong&gt;. If the install fails with 0x800f0954 on a WSUS-managed PC, enable the option to download optional features directly from Windows Update and try again. &lt;em&gt;(Reviewed October 2026.)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Need this done for you?&lt;/strong&gt; RSAT installed but AD or Group Policy still misbehaving? A working sysadmin can fix it remotely: &lt;a href="https://srvscripts.com/get-it-fixed/?pkg=hours&amp;amp;from=install-rsat-on-windows-11&amp;amp;place=early" rel="noopener noreferrer"&gt;Windows and Microsoft 365 help, $39 an hour&lt;/a&gt;, starts within 1 business day. &lt;a href="https://srvscripts.com/get-it-fixed/windows-server-microsoft-365-support/" rel="noopener noreferrer"&gt;What is included&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fu8skw593v9qrgojd1hqr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fu8skw593v9qrgojd1hqr.png" alt="Install RSAT on Windows 11 summary card: Open PowerShell as administrator and run Get-WindowsCapability -Name RSAT* -Online | Where-Object State -eq…" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In short: Open PowerShell as administrator and run Get-WindowsCapability -Name RSAT* -Online | Where-Object State -eq 'NotPresent' | Add-WindowsCapability -Online to install all RSAT tools, or pick them in Settings » System » Optional features » View features.&lt;/p&gt;
&lt;h2&gt;
  
  
  Table of Contents
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Which method to use&lt;/li&gt;
&lt;li&gt;Prerequisites&lt;/li&gt;
&lt;li&gt;RSAT tools and capability names&lt;/li&gt;
&lt;li&gt;Choose tools by role&lt;/li&gt;
&lt;li&gt;Method 1: Settings&lt;/li&gt;
&lt;li&gt;
Method 2: PowerShell

&lt;ul&gt;
&lt;li&gt;List the tools and their state&lt;/li&gt;
&lt;li&gt;Install one tool&lt;/li&gt;
&lt;li&gt;Install a typical admin set&lt;/li&gt;
&lt;li&gt;Install every RSAT tool&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Method 3: DISM&lt;/li&gt;
&lt;li&gt;Fix error 0x800f0954 on WSUS-managed PCs&lt;/li&gt;
&lt;li&gt;Deploy RSAT to many admin PCs&lt;/li&gt;
&lt;li&gt;Method 4: Offline from the Languages and Optional Features ISO&lt;/li&gt;
&lt;li&gt;
ARM64 devices

&lt;ul&gt;
&lt;li&gt;Windows Admin Center as an alternative&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Windows Server equivalents&lt;/li&gt;
&lt;li&gt;Secure the admin workstation&lt;/li&gt;
&lt;li&gt;Verify it works&lt;/li&gt;
&lt;li&gt;Troubleshooting&lt;/li&gt;
&lt;li&gt;Uninstall RSAT tools&lt;/li&gt;
&lt;li&gt;Install RSAT on Windows 11 at a glance&lt;/li&gt;
&lt;li&gt;Frequently asked questions&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Which method to use
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Method&lt;/th&gt;
&lt;th&gt;Best for&lt;/th&gt;
&lt;th&gt;Needs&lt;/th&gt;
&lt;th&gt;Notes&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Settings » Optional features&lt;/td&gt;
&lt;td&gt;One PC, a few tools&lt;/td&gt;
&lt;td&gt;Internet access to Windows Update&lt;/td&gt;
&lt;td&gt;Simplest; progress shown in Settings&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;PowerShell &lt;code&gt;Add-WindowsCapability&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;All tools at once, scripts&lt;/td&gt;
&lt;td&gt;Admin PowerShell&lt;/td&gt;
&lt;td&gt;Can install every RSAT tool in one line&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;DISM &lt;code&gt;/Add-Capability&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Task sequences, batch files, offline images&lt;/td&gt;
&lt;td&gt;Admin command prompt&lt;/td&gt;
&lt;td&gt;Same result; works with &lt;code&gt;/Source&lt;/code&gt; and &lt;code&gt;/LimitAccess&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Offline from the Languages and Optional Features ISO&lt;/td&gt;
&lt;td&gt;No internet, air-gapped or strict WSUS networks&lt;/td&gt;
&lt;td&gt;ISO matching the Windows 11 version&lt;/td&gt;
&lt;td&gt;No Windows Update traffic&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Windows Server &lt;code&gt;Install-WindowsFeature&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Management servers, jump hosts&lt;/td&gt;
&lt;td&gt;Windows Server 2016 to 2025&lt;/td&gt;
&lt;td&gt;RSAT is a server feature, not a capability&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;
&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Windows 11 Pro, Enterprise or Education. Windows 11 Home does not offer RSAT.&lt;/li&gt;
&lt;li&gt;A local administrator account or an elevated PowerShell or command prompt.&lt;/li&gt;
&lt;li&gt;Access to Windows Update, or to a Features on Demand source that matches your Windows 11 version.&lt;/li&gt;
&lt;li&gt;An x64 PC for the full set. On ARM64 only some tools are available (see below).&lt;/li&gt;
&lt;li&gt;For domain tools, the PC joined to the domain or able to reach a domain controller with suitable credentials.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  RSAT tools and capability names
&lt;/h2&gt;

&lt;p&gt;Each tool is a separate capability. You can install RSAT on Windows 11 one tool at a time and add more later.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Capability name&lt;/th&gt;
&lt;th&gt;What you get&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Rsat.ActiveDirectory.DS-LDS.Tools~~~~0.0.1.0&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Active Directory Users and Computers, Sites and Services, Domains and Trusts, ADSI Edit, Active Directory Administrative Center, the ActiveDirectory module&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Rsat.GroupPolicy.Management.Tools~~~~0.0.1.0&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Group Policy Management Console, editor and the GroupPolicy module&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Rsat.Dns.Tools~~~~0.0.1.0&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;DNS Manager, &lt;code&gt;dnscmd.exe&lt;/code&gt;, the DnsServer module&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Rsat.DHCP.Tools~~~~0.0.1.0&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;DHCP console, netsh context and the DhcpServer module&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Rsat.ServerManager.Tools~~~~0.0.1.0&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Server Manager&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Rsat.FailoverCluster.Management.Tools~~~~0.0.1.0&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Failover Cluster Manager and Cluster-Aware Updating&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Rsat.FileServices.Tools~~~~0.0.1.0&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;File Services tools, including DFS Management&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Rsat.CertificateServices.Tools~~~~0.0.1.0&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Certification Authority and related AD CS consoles&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Rsat.BitLocker.Recovery.Tools~~~~0.0.1.0&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;BitLocker recovery password viewer in AD&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Rsat.RemoteDesktop.Services.Tools~~~~0.0.1.0&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;RD Licensing Manager and RD Gateway Manager&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Rsat.WSUS.Tools~~~~0.0.1.0&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;WSUS console and the UpdateServices module&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Rsat.VolumeActivation.Tools~~~~0.0.1.0&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Volume Activation Tools for KMS&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Other capabilities cover IPAM, Network Load Balancing, Remote Access, Storage Replica, Storage Migration Service, Network Controller, LLDP, Shielded VM tools, System Insights and Azure Stack HCI.&lt;/p&gt;
&lt;h2&gt;
  
  
  Choose tools by role
&lt;/h2&gt;

&lt;p&gt;Installing every tool on every admin PC is convenient, but a smaller set keeps consoles tidy and updates faster. Typical sets:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Role&lt;/th&gt;
&lt;th&gt;Tools&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Service desk&lt;/td&gt;
&lt;td&gt;AD DS and LDS tools, BitLocker recovery tools, Group Policy Management (to read reports)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Server and infrastructure team&lt;/td&gt;
&lt;td&gt;Server Manager, AD DS, Group Policy, DNS, DHCP, File Services, Failover Clustering&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Network team&lt;/td&gt;
&lt;td&gt;DNS, DHCP, IPAM client, Remote Access management&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;PKI and update administrators&lt;/td&gt;
&lt;td&gt;Certificate Services tools, WSUS tools, Volume Activation tools&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;RSAT only provides the consoles and modules. What a user can change still depends on their rights in Active Directory, so installing the tools does not give the service desk any extra permissions.&lt;/p&gt;
&lt;h2&gt;
  
  
  Method 1: Settings
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Open &lt;strong&gt;Settings » System » Optional features&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Next to &lt;em&gt;Add an optional feature&lt;/em&gt;, select &lt;strong&gt;View features&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Type &lt;em&gt;RSAT&lt;/em&gt; in the search box.&lt;/li&gt;
&lt;li&gt;Tick the tools you need, for example &lt;em&gt;RSAT: Active Directory Domain Services and Lightweight Directory Services Tools&lt;/em&gt; and &lt;em&gt;RSAT: Group Policy Management Tools&lt;/em&gt;, then select &lt;strong&gt;Next&lt;/strong&gt; and &lt;strong&gt;Add&lt;/strong&gt; (or &lt;strong&gt;Install&lt;/strong&gt;).&lt;/li&gt;
&lt;li&gt;Wait until each item shows as installed on the Optional features page. No restart is normally needed.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The old &lt;em&gt;Turn Windows features on or off&lt;/em&gt; dialog in Control Panel is not used for RSAT on x64 Windows 11, and the standalone RSAT download packages only exist for Windows 10 releases before 1809.&lt;/p&gt;
&lt;h2&gt;
  
  
  Method 2: PowerShell
&lt;/h2&gt;

&lt;p&gt;PowerShell is the fastest way to install RSAT on Windows 11 when you want several tools. Open &lt;strong&gt;Terminal (Admin)&lt;/strong&gt; or Windows PowerShell as administrator.&lt;/p&gt;
&lt;h3&gt;
  
  
  List the tools and their state
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="nc"&gt;Get&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;WindowsCapability&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Name&lt;/span&gt; &lt;span class="no"&gt;RSAT&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Online&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="nc"&gt;Select&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Object&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Property&lt;/span&gt; &lt;span class="nc"&gt;DisplayName&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;Name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;State&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  Install one tool
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="nc"&gt;Add&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;WindowsCapability&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Online&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Name&lt;/span&gt; &lt;span class="s2"&gt;"Rsat.ActiveDirectory.DS-LDS.Tools~~~~0.0.1.0"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  Install a typical admin set
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$tools&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; @&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="s2"&gt;"Rsat.ActiveDirectory.DS-LDS.Tools~~~~0.0.1.0"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="s2"&gt;"Rsat.GroupPolicy.Management.Tools~~~~0.0.1.0"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="s2"&gt;"Rsat.Dns.Tools~~~~0.0.1.0"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="s2"&gt;"Rsat.DHCP.Tools~~~~0.0.1.0"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="s2"&gt;"Rsat.ServerManager.Tools~~~~0.0.1.0"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;foreach&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$t&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="nv"&gt;$tools&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nc"&gt;Add&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;WindowsCapability&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Online&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Name&lt;/span&gt; &lt;span class="nv"&gt;$t&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  Install every RSAT tool
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="nc"&gt;Get&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;WindowsCapability&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Name&lt;/span&gt; &lt;span class="no"&gt;RSAT&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Online&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;
  &lt;span class="nc"&gt;Where&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Object&lt;/span&gt; &lt;span class="nc"&gt;State&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;eq&lt;/span&gt; &lt;span class="s1"&gt;'NotPresent'&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;
  &lt;span class="nc"&gt;Add&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;WindowsCapability&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Online&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;The full set takes several minutes and downloads a few hundred megabytes. Check the &lt;code&gt;RestartNeeded&lt;/code&gt; field of the output; it is usually &lt;em&gt;False&lt;/em&gt;.&lt;/p&gt;
&lt;h2&gt;
  
  
  Method 3: DISM
&lt;/h2&gt;

&lt;p&gt;DISM does the same job from a command prompt, which suits batch files and task sequences:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;DISM /Online /Get-Capabilities /Format:Table | findstr /i "Rsat"
DISM /Online /Add-Capability /CapabilityName:Rsat.GroupPolicy.Management.Tools~~~~0.0.1.0
DISM /Online /Add-Capability /CapabilityName:Rsat.Dns.Tools~~~~0.0.1.0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;DISM writes its log to &lt;code&gt;C:\Windows\Logs\DISM\dism.log&lt;/code&gt;, and servicing details go to &lt;code&gt;C:\Windows\Logs\CBS\CBS.log&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Fix error 0x800f0954 on WSUS-managed PCs
&lt;/h2&gt;

&lt;p&gt;When a PC gets updates from WSUS, it also asks WSUS for Features on Demand. WSUS does not serve those payloads, so Settings shows &lt;em&gt;Couldn’t install&lt;/em&gt; and PowerShell or DISM fail with &lt;strong&gt;0x800f0954&lt;/strong&gt;. Allow the PC to fetch optional features directly from Windows Update:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;In a GPO linked to your admin workstations (or in &lt;code&gt;gpedit.msc&lt;/code&gt; for a single PC) go to &lt;code&gt;Computer Configuration » Policies » Administrative Templates » System&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Open &lt;strong&gt;“Specify settings for optional component installation and component repair”&lt;/strong&gt; and choose &lt;strong&gt;Enabled&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Tick &lt;strong&gt;“Download repair content and optional features directly from Windows Update instead of Windows Server Update Services (WSUS)”&lt;/strong&gt;. Make sure &lt;strong&gt;“Never attempt to download payload from Windows Update”&lt;/strong&gt; is not ticked.&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;gpupdate /force&lt;/code&gt; and repeat the install.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The policy writes &lt;code&gt;RepairContentServerSource = 2&lt;/code&gt; (REG_DWORD) to &lt;code&gt;HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Servicing&lt;/code&gt;. Normal quality updates keep coming from WSUS. If the network blocks Windows Update entirely, use the offline method instead, or set &lt;strong&gt;Alternate source file path&lt;/strong&gt; in the same policy to a share that holds the Features on Demand files.&lt;/p&gt;

&lt;h2&gt;
  
  
  Deploy RSAT to many admin PCs
&lt;/h2&gt;

&lt;p&gt;To install RSAT on Windows 11 across a team, run the same capability list from a script that is safe to repeat:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$caps&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; @&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="s2"&gt;"Rsat.ActiveDirectory.DS-LDS.Tools~~~~0.0.1.0"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="s2"&gt;"Rsat.GroupPolicy.Management.Tools~~~~0.0.1.0"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="s2"&gt;"Rsat.Dns.Tools~~~~0.0.1.0"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;foreach&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$c&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="nv"&gt;$caps&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Get&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;WindowsCapability&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Online&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Name&lt;/span&gt; &lt;span class="nv"&gt;$c&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;State&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;ne&lt;/span&gt; &lt;span class="s1"&gt;'Installed'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nc"&gt;Add&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;WindowsCapability&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Online&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Name&lt;/span&gt; &lt;span class="nv"&gt;$c&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="nc"&gt;Out&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="kc"&gt;Null&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Group Policy:&lt;/strong&gt; run it as a computer startup script in a GPO linked to the admin workstation OU, together with the optional component policy from the section below.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Intune:&lt;/strong&gt; add it under &lt;strong&gt;Devices » Scripts and remediations » Platform scripts&lt;/strong&gt;, set &lt;strong&gt;Run this script using the logged on credentials&lt;/strong&gt; to &lt;em&gt;No&lt;/em&gt; so it runs as SYSTEM, and &lt;strong&gt;Run script in 64 bit PowerShell Host&lt;/strong&gt; to &lt;em&gt;Yes&lt;/em&gt;. Intune-managed PCs that use Windows Update for Business download the tools directly.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Configuration Manager:&lt;/strong&gt; deploy the script as an application or a task sequence step; with the offline source, add &lt;code&gt;-Source&lt;/code&gt; and &lt;code&gt;-LimitAccess&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;After a Windows 11 feature update, run the verification commands again and reinstall any tool that reports &lt;em&gt;NotPresent&lt;/em&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Method 4: Offline from the Languages and Optional Features ISO
&lt;/h2&gt;

&lt;p&gt;For air-gapped networks, install RSAT on Windows 11 from the &lt;strong&gt;Languages and Optional Features&lt;/strong&gt; ISO, which you get from volume licensing downloads or a Visual Studio subscription. RSAT is on that ISO, not on the separate Features on Demand 2 ISO. The ISO must match the Windows 11 version you are installing on.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Copy the ISO to the PC or to a share and mount it:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;   &lt;span class="nc"&gt;Mount&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;DiskImage&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;ImagePath&lt;/span&gt; &lt;span class="s2"&gt;"C:\ISO\Win11_LanguagesAndOptionalFeatures.iso"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Note the drive letter (here &lt;code&gt;E:&lt;/code&gt;) and point the install at the folder that holds the &lt;code&gt;.cab&lt;/code&gt; files:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;   &lt;span class="nc"&gt;Add&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;WindowsCapability&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Online&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Name&lt;/span&gt; &lt;span class="s2"&gt;"Rsat.ActiveDirectory.DS-LDS.Tools~~~~0.0.1.0"&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Source&lt;/span&gt; &lt;span class="s2"&gt;"E:\LanguagesAndOptionalFeatures"&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;LimitAccess&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Or with DISM:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   DISM /Online /Add-Capability /CapabilityName:Rsat.GroupPolicy.Management.Tools~~~~0.0.1.0 /Source:E:\LanguagesAndOptionalFeatures /LimitAccess
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;-LimitAccess&lt;/code&gt; stops Windows from contacting Windows Update or WSUS. For many PCs, copy the folder to a read-only share such as &lt;code&gt;\\fs01\FoD\Win11&lt;/code&gt; and use it as the source, or set it as the &lt;strong&gt;Alternate source file path&lt;/strong&gt; in the policy above.&lt;/p&gt;

&lt;h2&gt;
  
  
  ARM64 devices
&lt;/h2&gt;

&lt;p&gt;RSAT Features on Demand are not supported on Arm64. On Windows 11 version 25H2 for Arm64, some tools are instead available in &lt;strong&gt;Control Panel » Programs » Programs and Features » Turn Windows features on or off&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;RSAT: Active Directory Domain Services and Lightweight Directory Services Tools&lt;/li&gt;
&lt;li&gt;RSAT: Active Directory Certificate Services Tools&lt;/li&gt;
&lt;li&gt;RSAT: Server Manager&lt;/li&gt;
&lt;li&gt;RSAT: Group Policy Management Tools&lt;/li&gt;
&lt;li&gt;RSAT: DNS Server Tools&lt;/li&gt;
&lt;li&gt;RSAT: DHCP Server Tools&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For other tools on Arm64, use a management server or Windows Admin Center.&lt;/p&gt;

&lt;h3&gt;
  
  
  Windows Admin Center as an alternative
&lt;/h3&gt;

&lt;p&gt;Windows Admin Center is a browser-based console installed on a gateway server. It covers many day-to-day server tasks, such as services, event logs, files, updates and roles, without any RSAT tools on the client. It does not replace every MMC console, so most administrators still install RSAT on Windows 11 for Active Directory and Group Policy work.&lt;/p&gt;

&lt;h2&gt;
  
  
  Windows Server equivalents
&lt;/h2&gt;

&lt;p&gt;On Windows Server 2016 to 2025, RSAT tools are Windows features:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="nc"&gt;Get&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;WindowsFeature&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Name&lt;/span&gt; &lt;span class="no"&gt;RSAT&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;
&lt;span class="nc"&gt;Install&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;WindowsFeature&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Name&lt;/span&gt; &lt;span class="no"&gt;RSAT&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="no"&gt;AD&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Tools&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;IncludeAllSubFeature&lt;/span&gt;
&lt;span class="nc"&gt;Install&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;WindowsFeature&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Name&lt;/span&gt; &lt;span class="no"&gt;GPMC&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;RSAT&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="no"&gt;DNS&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Server&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;RSAT&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="no"&gt;DHCP&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;RSAT&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Clustering&lt;/span&gt;
&lt;span class="nc"&gt;Install&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;WindowsFeature&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Name&lt;/span&gt; &lt;span class="no"&gt;RSAT&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;IncludeAllSubFeature&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The last line installs every administration tool. On Server Core only the PowerShell modules are useful, because the MMC consoles need the Desktop Experience.&lt;/p&gt;

&lt;h2&gt;
  
  
  Secure the admin workstation
&lt;/h2&gt;

&lt;p&gt;RSAT turns a PC into a management station, so treat it like one:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Install the tools on dedicated admin workstations rather than on every user’s laptop, and sign in to them with separate admin accounts.&lt;/li&gt;
&lt;li&gt;Do not browse the web or read email with the account that manages Active Directory.&lt;/li&gt;
&lt;li&gt;Delegate only the rights each team needs, for example password resets for the service desk, instead of adding people to Domain Admins.&lt;/li&gt;
&lt;li&gt;Keep the PC on the current Windows 11 version. The tools are serviced with the monthly cumulative updates, so there is nothing separate to patch.&lt;/li&gt;
&lt;li&gt;Restrict who can sign in to admin workstations with a GPO and audit logons to them.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Verify it works
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;List what is installed:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;   &lt;span class="nc"&gt;Get&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;WindowsCapability&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Name&lt;/span&gt; &lt;span class="no"&gt;RSAT&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Online&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="nc"&gt;Where&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Object&lt;/span&gt; &lt;span class="nc"&gt;State&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;eq&lt;/span&gt; &lt;span class="s1"&gt;'Installed'&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="nc"&gt;Select&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Object&lt;/span&gt; &lt;span class="nc"&gt;DisplayName&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Check the modules: &lt;code&gt;Get-Module -ListAvailable ActiveDirectory, GroupPolicy, DnsServer, DhcpServer&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Test a query: &lt;code&gt;Get-ADDomain&lt;/code&gt; or &lt;code&gt;Get-GPO -All | Select-Object -First 5 DisplayName&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Open the consoles from &lt;strong&gt;Start » All apps » Windows Tools&lt;/strong&gt; or run &lt;code&gt;dsa.msc&lt;/code&gt;, &lt;code&gt;gpmc.msc&lt;/code&gt;, &lt;code&gt;dnsmgmt.msc&lt;/code&gt; and &lt;code&gt;dhcpmgmt.msc&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Troubleshooting
&lt;/h2&gt;

&lt;p&gt;If you cannot install RSAT on Windows 11, match the error to the table:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Symptom&lt;/th&gt;
&lt;th&gt;Cause&lt;/th&gt;
&lt;th&gt;Fix&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;0x800f0954&lt;/td&gt;
&lt;td&gt;PC points at WSUS, which does not host FoD&lt;/td&gt;
&lt;td&gt;Enable the optional component policy with the Windows Update option&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0x800f081f, source files not found&lt;/td&gt;
&lt;td&gt;Offline source missing or for a different Windows version&lt;/td&gt;
&lt;td&gt;Use the matching Languages and Optional Features ISO and the correct folder&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;No RSAT entries in Settings&lt;/td&gt;
&lt;td&gt;Windows 11 Home, or an Arm64 device&lt;/td&gt;
&lt;td&gt;Upgrade the edition; on Arm64 use Windows Features&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Install stuck or pending&lt;/td&gt;
&lt;td&gt;A pending update or restart, or a busy servicing stack&lt;/td&gt;
&lt;td&gt;Restart, install pending updates, then retry&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Consoles open but fail to connect&lt;/td&gt;
&lt;td&gt;Firewall, DNS or permissions on the server side&lt;/td&gt;
&lt;td&gt;Test &lt;code&gt;Test-NetConnection dc01 -Port 389&lt;/code&gt; and run the console as a domain admin&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Access denied during install&lt;/td&gt;
&lt;td&gt;Shell not elevated&lt;/td&gt;
&lt;td&gt;Run PowerShell or Command Prompt as administrator&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Installed, but no shortcut in Start&lt;/td&gt;
&lt;td&gt;Consoles are grouped in the Windows Tools folder&lt;/td&gt;
&lt;td&gt;Open &lt;strong&gt;Windows Tools&lt;/strong&gt; or start the &lt;code&gt;.msc&lt;/code&gt; file directly&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Module not found in PowerShell 7&lt;/td&gt;
&lt;td&gt;Old session opened before the install&lt;/td&gt;
&lt;td&gt;Open a new session; import with &lt;code&gt;Import-Module ActiveDirectory&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;For deeper analysis, search &lt;code&gt;dism.log&lt;/code&gt; and &lt;code&gt;CBS.log&lt;/code&gt; for the capability name. Component store corruption can also block Features on Demand; repair it with &lt;code&gt;DISM /Online /Cleanup-Image /RestoreHealth&lt;/code&gt; first.&lt;/p&gt;

&lt;h2&gt;
  
  
  Uninstall RSAT tools
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Settings:&lt;/strong&gt; &lt;strong&gt;Settings » System » Optional features&lt;/strong&gt;, expand the tool under installed features and select &lt;strong&gt;Remove&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;PowerShell:&lt;/strong&gt; &lt;code&gt;Remove-WindowsCapability -Online -Name "Rsat.Dns.Tools~~~~0.0.1.0"&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;DISM:&lt;/strong&gt; &lt;code&gt;DISM /Online /Remove-Capability /CapabilityName:Rsat.Dns.Tools~~~~0.0.1.0&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Windows Server:&lt;/strong&gt; &lt;code&gt;Uninstall-WindowsFeature -Name RSAT-DNS-Server&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If a removal fails because another RSAT tool depends on it, remove the dependent tool first. When you install RSAT on Windows 11 for a team, script the same capability list for every admin PC so the consoles and module versions stay consistent.&lt;/p&gt;

&lt;h2&gt;
  
  
  Install RSAT on Windows 11 at a glance
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fzzattd0xc5cfsxzhfb06.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fzzattd0xc5cfsxzhfb06.png" alt="Install RSAT on Windows 11 – questions answered" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Install RSAT on Windows 11: the questions this guide answers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Official documentation:&lt;/strong&gt; &lt;a href="https://learn.microsoft.com/en-us/troubleshoot/windows-server/system-management-components/remote-server-administration-tools" rel="noopener noreferrer"&gt;Remote Server Administration Tools (RSAT) for Windows&lt;/a&gt;, &lt;a href="https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/features-on-demand-non-language-fod" rel="noopener noreferrer"&gt;Available Features on Demand (non-language)&lt;/a&gt;, &lt;a href="https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/configure-a-windows-repair-source" rel="noopener noreferrer"&gt;Configure a Windows repair source&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Related guides:&lt;/strong&gt; &lt;a href="https://srvscripts.com/guides/install-active-directory-windows-server-2025/" rel="noopener noreferrer"&gt;Install Active Directory on Windows Server 2025: New Forest Step by Step&lt;/a&gt; · &lt;a href="https://srvscripts.com/guides/wsus-windows-server-2025/" rel="noopener noreferrer"&gt;WSUS Windows Server 2025: Reliable Install and Configuration&lt;/a&gt; · &lt;a href="https://srvscripts.com/guides/dism-restorehealth-offline-source/" rel="noopener noreferrer"&gt;DISM RestoreHealth Offline Source: Proven Windows 11 Repair&lt;/a&gt; · &lt;a href="https://srvscripts.com/guides/install-rsat-windows-server-2025/" rel="noopener noreferrer"&gt;Install RSAT on Windows Server 2025&lt;/a&gt;.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://srvscripts.com/guides/install-rsat-on-windows-11/" rel="noopener noreferrer"&gt;srvScripts&lt;/a&gt; — tested how-to guides and free tools for people who run servers.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>windows</category>
      <category>sysadmin</category>
      <category>powershell</category>
      <category>activedirectorycd</category>
    </item>
  </channel>
</rss>
