How To Create An ADMX Template - 4sysops
How To Create An ADMX Template - 4sysops
In this howto, I'll explain how to create a basic ADMX template from scratch
and use it in a working example. When I was writing my first application that
works with GPOs, at the point of writing my first ADMX template, I realized that
ADMX Migrator from Microsoft didn't work as expected. So I dug through offi‐
cial documentation, reverse engineered some existing templates, and found a
way to write my own templates.
Remove local admin rights, elevate apps for users bypassing UAC password prompts
Try Securden for free!! Ad
Contents C LO S E
01 ADMX template structure
https://4sysops.com/archives/how-to-create-an-admx-template/ 1/13
29/12/2023, 16:41 How to create an ADMX template – 4sysops
08 Final result
09 Conclusion
Riccardo Bicelli (Https://4sysops.Com/Members/Riccardo-
Bicelli/)
Riccardo is a system administrator and software developer for small and mid-size busi‐
nesses in Italy.
(https://4s
ysops.‐
com/mem
bers/ric‐
cardo-
bicelli/)
https://4sysops.com/archives/how-to-create-an-admx-template/ 2/13
29/12/2023, 16:41 How to create an ADMX template – 4sysops
more XML files that contain instructions for manipulating those registry settings.
FREE PC, Mac & Mobile Management - Desktop Sharing - Software Installation - Inventory
Download ManageEngine Endpoint Central now! Ad
As shown below, the typical tree structure of an ADMX template looks like this:
1. ───ADMXfiles
2. │ LogonMessageBox.admx
3. │ MyCompany.admx
4. │
5. └───en-US
6. LogonMessageBox.adml
7. MyCompany.adml
ADML files are language localization files, which are loaded by the Group Policy
Editor snap-in according to current locale settings.
https://4sysops.com/archives/how-to-create-an-admx-template/ 3/13
29/12/2023, 16:41 How to create an ADMX template – 4sysops
https://4sysops.com/archives/how-to-create-an-admx-template/ 4/13
29/12/2023, 16:41 How to create an ADMX template – 4sysops
As a result, the Group Policy Editor includes settings that appear under
Administrative Templates\My Company\Logon Message Box.
https://4sysops.com/archives/how-to-create-an-admx-template/ 5/13
29/12/2023, 16:41 How to create an ADMX template – 4sysops
https://4sysops.com/archives/how-to-create-an-admx-template/ 6/13
29/12/2023, 16:41 How to create an ADMX template – 4sysops
The tag parentCategory refers to the category (folder) in GPMC. In this case, the
parent category is My Company\Logon Message Box.
The tags enabledValue and disabledValues contain the values that the registry key
will assume if the policy is enabled or disabled.
Value Explanation
delete The registry key is deleted
decimal value = “%n” Where %n is a decimal number
String value = “%s” Where %s is a string
Although you can manipulate any registry key as needed, it is advisable to use a
subkey under Software\Policies (e.g.,
Software\Policies\MyCompany\LogonMessage). These subkeys are locked by
the user editing the machine as part of the AD domain.
The text item defines an input string. In the corresponding ADML file, we see a new
section called presentationTable, which is referred to by the presentation attribute in
the ADMX policy section:
1. <presentationTable>
2. <presentation id="LogonMessageBoxTitle">
3. <textBox refId="LogonMessageBoxTitle">
4. <label>Message Box Title:</label>
5. </textBox>
6. </presentation>
7. </presentationTable>
https://4sysops.com/archives/how-to-create-an-admx-template/ 7/13
29/12/2023, 16:41 How to create an ADMX template – 4sysops
This syntax instructs the GPMC snap-in to interpret the text with ID
LogonMessageBoxTitle as a textbox.
(https://4sysops.com/wp-content/uploads/2020/09/GPMC-renders-as-textbox.png)
https://4sysops.com/archives/how-to-create-an-admx-template/ 8/13
29/12/2023, 16:41 How to create an ADMX template – 4sysops
24. </value>
25. </item>
26. </enum>
27. </elements>
28. </policy>
The enum tag contains various items, each of which represents an entry in the drop‐
down list. The corresponding presentation section in the ADML files look like this:
1. <presentation id="LogonMessageBoxIcon">
2. <dropdownList refId="LogonMessageBoxIcon"
noSort="true">Icon</dropdownList>
3. </presentation>
(https://4sysops.com/wp-content/up‐
loads/2020/09/GPMC-renders-a-drop‐
down-list.png)
Final result
You can put the ADMX templates in %WINDIR%\PolicyDefinitions or in the central
store, create a GPO object, and edit the policy settings regarding the message box
to add the LogonMessageBox.vbs script to user logon.
At user logon, you will see the message box with the settings defined in the policy:
Email address
Subscribe
https://4sysops.com/archives/how-to-create-an-admx-template/ 9/13
29/12/2023, 16:41 How to create an ADMX template – 4sysops
(https://4sysops.com/wp-content/uploads/2020/09/The-
script-in-action.png)
Conclusion
The ability to write ADMX templates can be useful in many Sysadmin/DevOps sce‐
narios. Now you can control your users' logon scripts if you want. For a deeper look
at this tutorial, see my github repo (https://github.com/rbicelli/example-admx-
template).
+2
(https://4sysops.com/members/paolo/)
Achieve rapid response and reliable recovery from ransomware attacks for data center- and cloud
Download Veeam Data Platform>> Ad
https://4sysops.com/archives/how-to-create-an-admx-template/ 10/13
29/12/2023, 16:41 How to create an ADMX template – 4sysops
Do you want to write for 4sysops? We are looking for new authors.
(https://4sysops.com/write-for-4sysops//?
utm_source=4sysops&utm_medium=endpage&utm_campaign=Author)
R E L AT E D A R T I C L E S
(https://4sysops.com/archives/create-
(https://4sysops.com/archives/migrate-
(https://4sysops.com/archive
a-free-lab-for-microsoft- microsoft-entra-connect- playbook-examples/)
365-and-intune/) azure-ad-connect-to-a-
Ansible Playbook
new-server/)
Create a free lab for examples
Microsoft 365 and Intune Migrate Microsoft Entra (https://4sysops.com/archi
(https://4sysops.com/archives/create-
Connect (Azure AD playbook-examples/)
a-free-lab-for-microsoft- Connect) to a new server
365-and-intune/) (https://4sysops.com/archives/migrate-
(https://4sysops.com/archives/correct-update-order-for-vmware-vsphere-7-and-associated-
1 COMMENT
products/)
(https://4sysops.com/archives/userlock-control-user-logon-activity/)
Eric
2 years ago
Excellent tutorial!
+1
https://4sysops.com/archives/how-to-create-an-admx-template/ 11/13
29/12/2023, 16:41 How to create an ADMX template – 4sysops
REPLY (HTTPS://4SYSOPS.COM/ARCHIVES/HOW-TO-CREATE-AN-ADMX-TEMPLATE/?
REPLYTOCOM=1074584#RESPOND)
Leave a reply
Your email address will not be published. Required fields are marked *
Comment
Name *
Email*
Website
Notify me of followup comments via e-mail. You can also subscribe (https://4sysops.com/comment-
subscriptions/?srp=1557793&srk=125e4221f12cfb4a94bce2e06b44c1c2&sra=s&srsrc=f) without
commenting.
POST COMMENT
https://4sysops.com/archives/how-to-create-an-admx-template/ 12/13
29/12/2023, 16:41 How to create an ADMX template – 4sysops
Subscribe to Newsletter
Email Address
Subscribe
Follow 4sysops
(http://twitter.com/4sysops/) (http://www.facebook.com/4sysops)
(https://www.linkedin.com/company/4sysops/) (https://4sysops.com/feed/)
https://4sysops.com/archives/how-to-create-an-admx-template/ 13/13