In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
Xiaobian to share with you how to use batch processing to find ungrouped computers in the domain and display computer names and add domain users. I hope you will get something after reading this article. Let's discuss it together.
File name: querycomputer.bat
Function: find the ungrouped computers in the domain and display the computer name and the users of the added domain
Function: you can monitor the list of computers to remind you to group computers, or you can audit whether the naming of computers is standardized and determine who is responsible.
Note: before running the batch, it is best to group all the computers in the existing domain computers container according to OU, and the new computers in the computers container will be listed after the script is run.
The code is as follows:
@ echo off
Ungrouped computer monitoring in the echo domain
If echo finds a computer, it displays a list of found computers and prompts you through the PC horn.
Echo.
Cd / d% ~ dp0
Rem sets the NETBIOS domain name
Set domain=DOMAINNAME
Rem sets the domain name
Set DC=mydomain
Set DC1=com
: loop
Set found=0
Rem search for comouters
For / f%% I in ('dsquery computer CN ^ = computers ^, DC ^ =% DC% ^, DC ^ =% DC 1') do set found=1
If rem finds the computer, it calls the display module.
If% found%==1 call: display
Ping-n 600 127.0.0.1 > NUL 2 > & 1
Goto loop
Goto: eof
: display
Echo% date%% time% found following computers:
Rem reads the computer AD path and calls the display information module
For / f%% I in ('dsquery computer CN ^ = computers^, DC ^ =% DC% ^, DC ^ =% DC 1%') do call: info%% I
Goto: eof
: info
Set dsname=%1
Set dsname1=//%DC%.%DC1%/%dsname: "=%
Rem gets the computer name
For / f "tokens=2,3* delims=,=" I in ('echo dsname%') do set name=%%i
Rem displays computer permissions and shows authorized users (people who add domains) who can set DNS information. Dscals needs to install Support Tools.
Dsacls% dsname1% | find "% domain%" | find "DNS" > name.txt 2 > & 1
For / f "tokens=1,2,3*" I in (name.txt) do set user=%%j
Echo name%,%user%
Rem record information
Echo name%,%user% > > "date%.csv"
Rem beep called the police, beep wrote it himself or looked for it on the Internet.
Echo.
Beep 1500 500
Beep 500 500
Beep 1500 500
Beep 500 500
Beep 1500 500
Beep 500 500
Beep 1500 500
Beep 500 500
Goto: eof
After reading this article, I believe you have a certain understanding of "how to use batch processing to find ungrouped computers in the domain and display computer names and added domains". If you want to know more about it, you are welcome to follow the industry information channel. thank you for reading!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.