Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

[AD] [Group Policy] the method of using startup scripts to install fonts for ordinary domain users

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

Administrator privileges are required to install fonts by default.

If you just copy the font file into% systemroot%\ fonts, it cannot be recognized by the system as a font that has been installed. At the same time, you need to write an entry in the registry in the following location.

Hklm\ SOFTWARE\ Microsoft\ Windows NT\ CurrentVersion\ Fonts. You can check the format for yourself.

So after knowing how to correctly install the script. You can use the startup script to do it. Because the startup script uses nt authority\ system permissions.

The default in the font folder before installation is as follows:

The registry is as follows:

After the script completes the installation, it is as follows:

Registry:

The script reads as follows:

@ echo off

:: the following can be deleted in order to test whether the script executes properly

::

Rem this script creates a folder with a computer name and date in the root directory of disk C at startup

Set yawning% dateGlux 0Magne0 Magi 4% dateRu Zuo 5Magi 2% dateRu Juan 8 pas 2% TimeRu Zhe 0pi 2% TIMRO Zhe 3pi 2%

Md "c:\% y% computers% computername%"

::

:: the following is to set the name of fonts

Set Xerox% dateGRO 0Magi 4% dateRu 5JI 2% dateRod 8% 2%

:: share path

Set paath=\ 192.168.1.160\ abc

:: access to the shared host

Set usr=administrator@kaedeleo.com

Set psd=1

:: share IP

Set ip=192.168.1.160

:: because it is a startup script, you should first create an empty connection to the target computer

Net use\% ip%\ ipc$ / user:%usr%% psd%

:: test whether the empty connection is normal, write permission is required, and can be deleted.

::

Whoami >% paath%\ 1.txt

::

:: use a txt document name of the current date to determine whether the following needs to be executed, so that the script can be controlled.

If exist% paath%\% x%.txt goto abc else goto xyz

: abc

:: copy the font to the font directory and add the following registry information

Xcopy% paath%\% x%.TTF% systemroot%\ fonts & & reg add "hklm\ SOFTWARE\ Microsoft\ Windows NT\ CurrentVersion\ Fonts" / v% x% (TrueType) / t reg_sz / d% x%.ttf

Xcopy% paath%\% x%1.TTF% systemroot%\ fonts & & reg add "hklm\ SOFTWARE\ Microsoft\ Windows NT\ CurrentVersion\ Fonts" / v% x% 1 (TrueType) / t reg_sz / d% x%1.ttf

Xcopy% paath%\% x%2.TTF% systemroot%\ fonts & & reg add "hklm\ SOFTWARE\ Microsoft\ Windows NT\ CurrentVersion\ Fonts" / v% x% 2 (TrueType) / t reg_sz / d% x%2.ttf

Xcopy% paath%\% x%3.TTF% systemroot%\ fonts & & reg add "hklm\ SOFTWARE\ Microsoft\ Windows NT\ CurrentVersion\ Fonts" / v% x% 3 (TrueType) / t reg_sz / d% x%3.ttf

Xcopy% paath%\% x%4.TTF% systemroot%\ fonts & & reg add "hklm\ SOFTWARE\ Microsoft\ Windows NT\ CurrentVersion\ Fonts" / v% x% 4 (TrueType) / t reg_sz / d% x%4.ttf

:: must be restarted to take effect

Shutdown / r / t 00 / f

: xyz

Exit

The content of the script should be clear. What is tested in it is convenient for you to make mistakes. If you use it, you can delete it and make a dewatered version. Tell me why some of them did it.

The design department may use fonts more often, just set this script to start on a daily basis.

[if exist% paath%\% x%.txt goto abc else goto xyz]

It's also written in it, it's for control. If you don't usually need to install fonts, it's over at this point.

To install, you just need to change the font to the date of the day, such as changing Microsoft Acker.ttf to 20180523.ttf and putting it in the corresponding directory.

If there are more than one, change the name according to the content in the script. Five are given by default.

As shown below:

If user An asks you to install a font, you can change the font to the date of the day according to the picture above and put it in the directory. Create a new txt for the current date and put it in it. Tell user A, restart the computer, do not do anything after the restart, the computer will restart automatically after installing the font, it must be restarted to take effect. Then log in.

Some people will ask if it will restart indefinitely if the source ttf is there all the time.

No, the second execution will not continue because there are already files in the target folder. Then you can delete the date .ttf.

Ten minutes later, user An asked you to install a font again.

So if you start with 20180523, then use the following name, ask him to restart, and the installation will be done automatically.

Because of thinking about this, it leads to whether I can make a permanent auto-running startup script and login script.

This script is also controlled by the date .txt in the shared directory.

The script itself does not perform redundant operations, but is activated by the date .txt of the shared directory to start another BAT or Powershell.

In this way, I can easily execute other scripts without having to do new group policy refreshes and other operations. Avoid failure for unknown reasons.

So in order to avoid infinite loop, use xcopy override not to execute the following command and if exsit to determine the solution.

This script should initially write back the computer or user name to the shared directory and let the IT administrator know which ones failed to ensure that everyone gets the "root" script.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report