- 帖子
- 2
- 积分
- 13
- 技术
- 0
- 捐助
- 0
- 注册时间
- 2019-1-10
|
13楼
发表于 2019-1-10 11:11
| 只看该作者
@echo off
mode con cols=80 lines=30
cd /d %~dp0
echo *******************************输入域登录用户名*********************************
set /p ipname=
@echo off
cd /d %~dp0
rem 获取计算机型号
for /f "tokens=2 delims==" %%a in ('wmic csproduct get name /value') do (
set "Mode=%%a"
)
rem 获取序列号
for /f "tokens=2 delims==" %%a in ('wmic bios get serialnumber /value') do (
set "SN=%%a"
)
rem 提取计算机名
FOR /F "tokens=1,2,3,4,5,6,7,8 delims=, " %%a in ('type \\fileserver\YAPPIT\temp\act.bat^|find "%ipname%"') do (
echo. **************************本机信息********************
echo 员工姓名 【%%g】
echo 计算机名 【%%c】
echo IP地址 【%%d】
echo 网关 【%%e】
echo 计算机描述 【%%g,%%f】
echo. **************************本机信息********************
pause
set pcname=%%c
set ip=%%d
set gateway=%%e
set ms=%%g,%%f
rem 信息写入
echo 计算机名: %%c IP: %%d 序列号: %SN% >c:\version\%%f_%%g_%%c_"%mode%".txt
echo 计算机名: %%c IP: %%d 序列号: %SN% >\\fileserver\adcheck\2019\%%f_%%g_%%c_"%mode%".txt
)
pause
rem 更改计算机名和IP
reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\ComputerName\ComputerName" /v ComputerName /t reg_sz /d %pcname% /f >nul 2>nul
reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\ComputerName\ActiveComputerName" /v ComputerName /t reg_sz /d %pcname% /f >nul 2>nul
reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Tcpip\Parameters" /v "NV Hostname" /t reg_sz /d %pcname% /f >nul 2>nul
reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Tcpip\Parameters" /v Hostname /t reg_sz /d %pcname% /f >nul 2>nul
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\lanmanserver\parameters" /v "srvcomment" /t reg_sz /d %ms% /f >nul 2>nul
for /f "tokens=4*" %%a in ('netsh interface show interface ^| findstr "已连接"') do set "Name=%%~a"
echo 当前正在上网的网络连接名是【%Name%】
netsh interface ip set address name="%Name%" source=static addr=%ip% mask=255.255.255.0 gateway=%gateway%
netsh interface ip del dns name="%Name%" all >nul 2>nul
netsh interface ip set dns "%Name%" static 172.20.1.111 >nul 2>nul
netsh interface ip add dns "%Name%" 172.20.1.112 >nul 2>nul
@echo off
rem 姓名拼音,计算机名,电脑IP,网关,部门,姓名
rem x,HQ0572,192.168.xx.xx,192.168.xx.254,dep,某某
rem x,HQ0573,192.168.xx.xx,192.168.xx.254,dep,某某
rem x,HQ0574,192.168.xx.xx,192.168.xx.254,dep,某某
rem x,HQ0575,192.168.xx.xx,192.168.xx.254,dep,某某
rem x,HQ0576,192.168.xx.xx,192.168.xx.254,dep,某某
rem x,HQ0577,192.168.xx.xx,192.168.xx.254,dep,某某
现在自己在用的,400多用户,维护起来很方便,输入用户的姓名拼音或者计算机名就能快速写入计算机名,IP,并做好备注 |
|