操作系统

当前位置:金沙棋牌 > 操作系统 > 工作组的批处理金沙棋牌,计算机名

工作组的批处理金沙棋牌,计算机名

来源:http://www.logblo.com 作者:金沙棋牌 时间:2019-09-25 00:31

一、必要重启

复制代码 代码如下:

本身肩负的机关有过多台机器,重装完后内需还原原有配置,作者曾利用过大多主意:
1:手工业改动,那条就别说了
2:使用netsh dump +文件和 netsh -f +文件来改变,可是任何盘都格式化就没用.
3:使用专项使用的退换ip地址的小程序,但要么须要手工业来内定IP

复制代码 代码如下:

@echo off
set /p pcnanme=请输入Computer的名字:
reg add HKEY_LOCAL_MACHINESYSTEMControlSet001ControlComputerNameComputerName /v ComputerName /t REG_SZ /d %pcnanme% /f
eixt

@echo off
echo 骏龙包装计算机名称、Computer描述、专门的学业组修改批管理程序
Echo
pause
cls
:set/p id=请输入本机网段号:
:set/p ip=请输入本机IP地址:
:netsh interface ip set address name="本地连接" source=static addr=192.168.%id%.%ip% mask=255.255.255.0
set /p name=请输您的主机出厂S/N编号:
reg add "HKEY_LOCAL_MACHINESystemCurrentControlSetControlComputerNameActiveComputerName" /v ComputerName /t reg_sz /d %name% /f
reg add "HKEY_LOCAL_MACHINESystemCurrentControlSetServicesTcpipParameters" /v "NV Hostname" /t reg_sz /d %name% /f
reg add "HKEY_LOCAL_MACHINESystemCurrentControlSetServicesTcpipParameters" /v Hostname /t reg_sz /d %name% /f
SET work=骏龙
wmic computersystem where Name="%NAME%" call JoinDomainOrWorkgroup Name="%work%"
set /p describe=请输入您的管理器描述(公司鲜明必需是使用者姓名):
reg add "HKEY_LOCAL_MACHINESystemCurrentControlSetServiceslanmanserverParameters" /v srvcomment /t reg_sz /d %describe% /f

最终,作者想开如下办法:
1:首先完毕:netsh interface ip 来改换IP
2:使用wmic computersystem 修改职业组
3:使用reg add 来改动机器名
4:因为修改机器名后要重启才生效,于是选取:reboot.inf 来重启
5:后来扩张了新机器名和ip的安插,使用机器的连串号(联想机:wmic bios get SerialNumber)来做机器名,ip地址最后1位使用随机
因为能够因而wmic来读取类别号,那么大家能够用来登记本机的网络布署时,就有助于多了.
6:最后将团结收拾的IP地址等相应表放到了bat中,制止bat调用别样文件.
7:达成地点功用后,笔者就可以将该bat文件封装到gho文件里面,恢复生机重启完后就足以自行安装,作者并不是做其余操作,客商就足以使用.假诺有至关重要,你能够增多实行完后活动删除本身.

@echo off
echo ----------------------------------
echo ----正在备份注册表 请稍后....----
echo ----------------------------------
  reg export "HKEY_LOCAL_MACHINE" C:/reg_backup.reg
echo ----------------------
echo ----注册表备份完毕----
echo ----------------------
  ping 127.0.0.1 -n 3 >nul
echo -----------------------------------
echo ----安全配置正在改写 请稍候...----
echo -----------------------------------
  @ping 127.0.0.1 -n 3 >nul
echo ----------------------
echo ----正在禁止使用空连接----
echo ----------------------
  reg add HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlLsa /v restrictanonymous /t reg_dword /d 1 /f
echo --------------------------
echo ----禁止使用空连接装置截至----
echo --------------------------
  @ping 127.0.0.1 -n 3 >nul
echo ------------------------
echo ----正在删除私下认可分享----
echo ------------------------
  reg add HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServiceslanmanserverparameters /v AutoShareServer /t reg_dword /d 0 /f
echo ----------------------------
echo ----删除暗许分享设置完结----
echo ----------------------------
  @ping 127.0.0.1 -n 3 >nul
echo ------------------------------
echo ----正在修改TTL值请稍后...----
echo ------------------------------
  reg add HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesTcpipParameters /v DefaultTTL /t reg_dword /d 53 /f
echo -------------------
echo ----TTL修改已毕----
echo -------------------
  @ping 127.0.0.1 -n 3 >nul
echo -----------------------
echo ----幸免syn湿害攻击----
echo -----------------------
  reg add HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesTcpipParameters /v SynAttackProtect /t reg_dword /d 2 /f
  reg add HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesTcpipParameters /v EnablePMTUDiscovery /t reg_dword /d 0 /f
  reg add HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesTcpipParameters /v NoNameReleaseOnDemand /t reg_dword /d 1 /f
  reg add HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesTcpipParameters /v EnableDeadGWDetect /t reg_dword /d 0 /f
  reg add HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesTcpipParameters /v KeepAliveTime /t reg_dword /d 300000 /f
  reg add HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesTcpipParameters /v PerformRouterDiscovery /t reg_dword /d 0 /f
  reg add HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesTcpipParameters /v EnableICMPRedirects /t reg_dword /d 0 /f
echo -------------------------------
echo ----幸免syn洪水攻击设置完结----
echo -------------------------------
  @ping 127.0.0.1 -n 3 >nul
echo ------------------------------
echo ------------------------------
echo ---- 系统服务修改 ----
echo ------------------------------
echo ------------------------------
  @ping 127.0.0.1 -n 3 >nul
echo --------------------
echo ----修改3389端口----
echo --------------------
  reg add "HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlTerminal ServerWds dpwdTdstcp" /v PortNumber /t reg_dword /d 44454 /f
  reg add "HKEY_LOCAL_MACHINESYSTEMCurrentContro1SetControlTenninal ServerWinStationsRDPTcp" /v PortNumber /t reg_dword /d 44454 /f
echo --------------------
echo ----修改PORT完毕----
echo --------------------
  @ping 127.0.0.1 -n 3 >nul
echo -------------------------------------
echo ----正在开启系统防火墙 请稍后....----
echo -------------------------------------
金沙棋牌,  sc config sharedaccess start= auto & net start sharedaccess
echo ------------------------
echo ----系统防火墙已展开----
echo ------------------------
  @ping 127.0.0.1 -n 3 >nul
echo ----------------------------
echo ----正在关闭共享打字与印刷服务----
echo ----------------------------
  @sc config Spooler start= disabled
  sc config LanmanServer start= disabled
  sc config LmHosts start= disabled
echo --------------------------
echo ----已关门分享打字与印刷服务----
echo --------------------------
  @ping 127.0.0.1 -n 3 >nul
echo ----------------------------
echo ----正在关闭远程支持服务----
echo ----------------------------
  @sc config RDSessMgr start= disabled
echo --------------------------
echo ----已关门远程协理服务----
echo --------------------------
  @ping 127.0.0.1 -n 3 >nul
echo ------------------------------
echo ----正在关闭远程注册表服务----
echo ------------------------------
  @sc config RemoteRegistry start= disabled
echo ----------------------------
echo ----已关闭远程注册表服务----
echo ----------------------------
  @ping 127.0.0.1 -n 3 >nul
echo ----------------------------
echo ----关闭自动硬件播放布告----
echo ----------------------------
  sc config ShellHWDetection start= disabled
echo -----------------------
echo ----自动播放文告关闭---
echo -----------------------
  @ping 127.0.0.1 -n 3 >nul
echo ----------------------------------------
echo ----正在关闭替换凭据下的起步进度服务----
echo ----------------------------------------
  sc config seclogon start= disabled
echo --------------------------
echo ----已关门运营进度服务----
echo --------------------------
  @ping 127.0.0.1 -n 3 >nul
echo ------------------------------------
echo ----IEEE 802.11 适配器的机动配置----
echo ------------------------------------
  sc config WZCSVC start= disabled
echo ------------------
echo ----已关闭IEEE----
echo ------------------
  @ping 127.0.0.1 -n 3 >nul
echo --------------------------
echo ----顾客端追踪服务关闭----
echo --------------------------
  sc config TrkSvr start= disabled
  sc config MSDTC start= disabled
echo ----------------------------
echo ----已关门客商端追踪服务----
echo ----------------------------
  @ping 127.0.0.1 -n 3 >nul
echo --------------------
echo ----支持主旨关闭----
echo --------------------
  sc config helpsvc start= disabled
echo --------------------------
echo ----已关门支持主题服务----
echo --------------------------
  @ping 127.0.0.1 -n 3 >nul
echo --------------------------------
echo --------------------------------
echo ---- 系统权限加固 ----
echo --------------------------------
echo --------------------------------
echo -------------------------------------------------------
echo ----C盘(系统盘) (administrators,system完全调节权限)----
echo -------------------------------------------------------
  cacls C: /t /c /g administrators:F system:F
echo -------------------------------------------
echo ----Common Files (everyone顾客只读权限)----
echo -------------------------------------------
  Cacls "C:Program FilesCommon Files" /t /e /c /g everyone:R
echo -------------------------------------------------------------
echo ----IIS Temporary Compressed Files (everyone客商改动权限)----
echo -------------------------------------------------------------
  Cacls "C:WINDOWSIIS Temporary Compressed Files" /t /e /c /g everyone:C
echo --------------------------------------------
echo ----Microsoft.Net (everyone客商只读权限)----
echo --------------------------------------------
  Cacls C:WINDOWSMicrosoft.Net /t /e /c /g everyone:R
echo ------------------------------------------------------
echo ----Temporary ASP.NET Files (everyone客商改造权限)----
echo ------------------------------------------------------
  Cacls "C:WINDOWSMicrosoft.NETFrameworkv1.1.4322Temporary ASP.NET Files" /t /e /c /g everyone:C
echo ------------------------------------------------------
echo ----Temporary ASP.NET Files (everyone顾客改动权限)----
echo ------------------------------------------------------
  Cacls "C:WINDOWSMicrosoft.NETFrameworkv2.0.50727Temporary ASP.NET Files" /t /e /c /g everyone:C
echo -------------------------------------------
echo ----Registration (everyone客户读取权限)----
echo -------------------------------------------
  Cacls C:WINDOWSRegistration /t /e /c /g everyone:R
echo -----------------------------------
echo ----Temp (everyone顾客改造权限)----
echo -----------------------------------
  Cacls C:WINDOWSTemp /t /e /c /g everyone:C
echo -------------------

亟需重启计算机本事奏效

net config server /SRVCOMMENT:"%describe%"
pause

一体代码如下:(款待我们继续优化和整理)

 @echo off
echo ----------------------------------
echo ----正在备份注册表 请稍后....----
echo ----------------------------------
  reg export "HKEY_LOCAL_MACHINE" C:/reg_backup.reg
echo ----------------------
echo ----注册表备份实现----
echo ----------------------
  ping 127.0.0.1 -n 3 >nul
echo -----------------------------------
echo ----安全布局正在改写 请稍候...----
echo -----------------------------------
  @ping 127.0.0.1 -n 3 >nul
echo ----------------------
echo ----正在禁止使用空连接----
echo ----------------------
  reg add HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlLsa /v restrictanonymous /t reg_dword /d 1 /f
echo --------------------------
echo ----禁止使用空连接装置达成----
echo --------------------------
  @ping 127.0.0.1 -n 3 >nul
echo ------------------------
echo ----正在删除暗中同意分享----
echo ------------------------
  reg add HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServiceslanmanserverparameters /v AutoShareServer /t reg_dword /d 0 /f
echo ----------------------------
echo ----删除暗中认可分享设置停止----
echo ----------------------------
  @ping 127.0.0.1 -n 3 >nul
echo ------------------------------
echo ----正在修改TTL值请稍后...----
echo ------------------------------
  reg add HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesTcpipParameters /v DefaultTTL /t reg_dword /d 53 /f
echo -------------------
echo ----TTL修改完成----
echo -------------------
  @ping 127.0.0.1 -n 3 >nul
echo -----------------------
echo ----制止syn山洪攻击----
echo -----------------------
  reg add HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesTcpipParameters /v SynAttackProtect /t reg_dword /d 2 /f
  reg add HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesTcpipParameters /v EnablePMTUDiscovery /t reg_dword /d 0 /f
  reg add HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesTcpipParameters /v NoNameReleaseOnDemand /t reg_dword /d 1 /f
  reg add HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesTcpipParameters /v EnableDeadGWDetect /t reg_dword /d 0 /f
  reg add HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesTcpipParameters /v KeepAliveTime /t reg_dword /d 300000 /f
  reg add HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesTcpipParameters /v PerformRouterDiscovery /t reg_dword /d 0 /f
  reg add HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesTcpipParameters /v EnableICMPRedirects /t reg_dword /d 0 /f
echo -------------------------------
echo ----防止syn山洪攻击设置截至----
echo -------------------------------
  @ping 127.0.0.1 -n 3 >nul
echo ------------------------------
echo ------------------------------
echo ---- 系统服务修改 ----
echo ------------------------------
echo ------------------------------
  @ping 127.0.0.1 -n 3 >nul
echo --------------------
echo ----修改3389端口----
echo --------------------
  reg add "HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlTerminal ServerWds dpwdTdstcp" /v PortNumber /t reg_dword /d 44454 /f
  reg add "HKEY_LOCAL_MACHINESYSTEMCurrentContro1SetControlTenninal ServerWinStationsRDPTcp" /v PortNumber /t reg_dword /d 44454 /f
echo --------------------
echo ----修改PORT完毕----
echo --------------------
  @ping 127.0.0.1 -n 3 >nul
echo -------------------------------------
echo ----正在张开系统防火墙 请稍后....----
echo -------------------------------------
  sc config sharedaccess start= auto & net start sharedaccess
echo ------------------------
echo ----系统防火墙已拉开----
echo ------------------------
  @ping 127.0.0.1 -n 3 >nul
echo ----------------------------
echo ----正在关闭分享打字与印刷服务----
echo ----------------------------
  @sc config Spooler start= disabled
  sc config LanmanServer start= disabled
  sc config LmHosts start= disabled
echo --------------------------
echo ----已关闭分享打字与印刷服务----
echo --------------------------
  @ping 127.0.0.1 -n 3 >nul
echo ----------------------------
echo ----正在关闭远程支持服务----
echo ----------------------------
  @sc config RDSessMgr start= disabled
echo --------------------------
echo ----已关门远程支持服务----
echo --------------------------
  @ping 127.0.0.1 -n 3 >nul
echo ------------------------------
echo ----正在关闭远程注册表服务----
echo ------------------------------
  @sc config RemoteRegistry start= disabled
echo ----------------------------
echo ----已关门远程注册表服务----
echo ----------------------------
  @ping 127.0.0.1 -n 3 >nul
echo ----------------------------
echo ----关闭自动硬件播放通告----
echo ----------------------------
  sc config ShellHWDetection start= disabled
echo -----------------------
echo ----自动播放布告关闭---
echo -----------------------
  @ping 127.0.0.1 -n 3 >nul
echo ----------------------------------------
echo ----正在关闭替换凭据下的起步过程服务----
echo ----------------------------------------
  sc config seclogon start= disabled
echo --------------------------
echo ----已关门运维进度服务----
echo --------------------------
  @ping 127.0.0.1 -n 3 >nul
echo ------------------------------------
echo ----IEEE 802.11 适配器的自行配置----
echo ------------------------------------
  sc config WZCSVC start= disabled
echo ------------------
echo ----已关闭IEEE----
echo ------------------
  @ping 127.0.0.1 -n 3 >nul
echo --------------------------
echo ----顾客端跟踪服务关闭----
echo --------------------------
  sc config TrkSvr start= disabled
  sc config MSDTC start= disabled
echo ----------------------------
echo ----已关门客户端追踪服务----
echo ----------------------------
  @ping 127.0.0.1 -n 3 >nul
echo --------------------
echo ----协助大旨关闭----
echo --------------------
  sc config helpsvc start= disabled
echo --------------------------
echo ----已关门帮忙中央服务----
echo --------------------------
  @ping 127.0.0.1 -n 3 >nul
echo --------------------------------
echo --------------------------------
echo ---- 系统权限加固 ----
echo --------------------------------
echo --------------------------------
echo -------------------------------------------------------
echo ----C盘(系统盘) (administrators,system完全调整权限)----
echo -------------------------------------------------------
  cacls C: /t /c /g administrators:F system:F
echo -------------------------------------------
echo ----Common Files (everyone客户只读权限)----
echo -------------------------------------------
  Cacls "C:Program FilesCommon Files" /t /e /c /g everyone:R
echo -------------------------------------------------------------
echo ----IIS Temporary Compressed Files (everyone客户更换权限)----
echo -------------------------------------------------------------
  Cacls "C:WINDOWSIIS Temporary Compressed Files" /t /e /c /g everyone:C
echo --------------------------------------------
echo ----Microsoft.Net (everyone客商只读权限)----
echo --------------------------------------------
  Cacls C:WINDOWSMicrosoft.Net /t /e /c /g everyone:R
echo ------------------------------------------------------
echo ----Temporary ASP.NET Files (everyone客商改换权限)----
echo ------------------------------------------------------
  Cacls "C:WINDOWSMicrosoft.NETFrameworkv1.1.4322Temporary ASP.NET Files" /t /e /c /g everyone:C
echo ------------------------------------------------------
echo ----Temporary ASP.NET Files (everyone客户改变权限)----
echo ------------------------------------------------------
  Cacls "C:WINDOWSMicrosoft.NETFrameworkv2.0.50727Temporary ASP.NET Files" /t /e /c /g everyone:C
echo -------------------------------------------
echo ----Registration (everyone顾客读取权限)----
echo -------------------------------------------
  Cacls C:WINDOWSRegistration /t /e /c /g everyone:R
echo -----------------------------------
echo ----Temp (everyone客户改动权限)----
echo -----------------------------------
  Cacls C:WINDOWSTemp /t /e /c /g everyone:C
echo -------------------
echo ----assembly (everyone客商读取权限)----
echo ---------------------------------------
  Cacls C:WINDOWSassembly /t /e /c /g everyone:R
echo -------------------------------------
echo ----WinSxS (everyone客户读取权限)----
echo -------------------------------------
  Cacls C:WINDOWSWinSxS /t /e /c /g everyone:R
echo ------------------------------------
echo ----Fonts (everyone顾客读取权限)----
echo ------------------------------------
  Cacls C:WINDOWSFonts /t /e /c /g everyone:R
echo ---------------------------------------
echo ----System32 (everyone客商读取权限)----
echo ---------------------------------------
  Cacls C:WINDOWSSystem32 /t /e /c /g everyone:R
echo ------------------------------------------
echo ----msdtc (networkservice客户更换权限)----
echo ------------------------------------------
  Cacls C:windowssystem32msdtc /t /e /c /g networkservice:C
echo -----------------------------------------------------
echo ----ASP Compiled Templates (everyone顾客改造权限)----
echo -----------------------------------------------------
  Cacls "C:WINDOWSsystem32inetsrvASP Compiled Templates" /t /e /c /g everyone:C
echo ------------------------------------
echo ----*.exe (去除everyone顾客权限)----
echo ------------------------------------
  Cacls C:WINDOWSSystem32*.exe /e /c /r everyone
echo ------------------------------------
echo ----cmd.exe (去除system客商权限)----
echo ------------------------------------
  Cacls C:WINDOWSSystem32cmd.exe /e /c /r system
echo ------------------------------------
echo ----net.exe (去除system客商权限)----
echo ------------------------------------
  Cacls C:WINDOWSSystem32 et.exe /e /c /r system
echo -------------------------------------
echo ----net1.exe (去除system客户权限)----
echo -------------------------------------
  Cacls C:WINDOWSSystem32 et1.exe /e /c /r system
echo ----------------------------------------
echo ----msdtc.exe (everyone客户读取权限)----
echo ----------------------------------------
  Cacls C:WINDOWSSystem32msdtc.exe /e /c /g everyone:R
echo ------------------------------------------
echo ----dllhost.exe (everyone客户读取权限)----
echo ------------------------------------------
  Cacls C:WINDOWSSystem32dllhost.exe /e /c /g everyone:R
echo ------------------------------------------
echo ----svchost.exe (everyone客户读取权限)----
echo ------------------------------------------
  Cacls C:WINDOWSSystem32svchost.exe /e /c /g everyone:R
echo --------------------
echo --------------------
echo ----系统加固完毕----
echo --------------------
echo --------------------
  @ping 127.0.0.1 -n 3 >nul
echo -----------------------------
echo ----安全设置截止 款待使用----
echo -----------------------------
echo ------------------
echo ----重启服务器----
echo ------------------
  @ping 127.0.0.1
  shutdown -r
  @pause

 

用批处理修改计算机名和专门的职业组,不用重启!

复制代码 代码如下:

将上边的代码保存为1.cmd或1.bat,双击运维下就能够。

二、无需重启

假使你开心用Ghost镜像的系统,那么每一回重装完毕之后的微型Computer名都是一串长长的随机字符,特别不便利和不雅观。
相似的话,你在系统质量这里修改Computer名大概专门的工作组,总是要开展重复起动,极度麻烦。以至在新式的Vista操作系统里面也是那般。
实在计算机名是保存在注册表里面包车型客车,大家得以因而直接修改注册表,到达修改的目标。

@echo off & code by m13632750052
for /f "tokens=12 delims= " %%i in ('ipconfig/all^|find "Physical Address"') do set localmac=%%i
echo 通过MAC地址%localmac%查究对应的机器名
for /f "skip=90 tokens=1,2,3,4 delims= " %%i in (%~f0) do (
if [%%k]==[%localmac%] set Name=%%i
if [%%k]==[%localmac%] set IP=%%j
if [%%k]==[%localmac%] set MAC=%%k
if [%%k]==[%localmac%] set Workgroup=%%l
set mask=255.255.0.0
set gway=168.30.1.233
set dns=168.1.4.147
set dns2=168.1.6.243
)
echo 展现查找结果 code by cn-dos breakme
if defined Name (echo %Name% %IP% %mac% %Workgroup%) else (goto newset)
:Enterset
for /l %%i in (3,-1,0) do ping -n 2 127.0.0.%%i>nul && @echo. %%i s 后修改机器名……

@echo off
set /p name=输入新的微机名称
wmic computersystem where "PrimaryOwnerName='%username%'" call rename %NAME%&exit
应用wmic改名不用重启

复制代码 代码如下:

reg add "HKEY_CURRENT_USERSoftwareMicrosoftWindowsShellNoRoam" /v @ /t REG_SZ /d "%Name%" /f
reg add "HKLMSYSTEMCurrentControlSetControlComputerNameComputerName" /v "ComputerName" /t REG_SZ /d "%Name%" /f
reg add "HKLMSYSTEMCurrentControlSetControlComputerNameActiveComputerName" /v "ComputerName" /t REG_SZ /d "%Name%" /f
reg add "HKLMSYSTEMCurrentControlSetServicesEventlog" /v "ComputerName" /t REG_SZ /d "%Name%" /f
reg add "HKLMSYSTEMCurrentControlSetControlComputerNameComputerName" /v "ComputerName" /t REG_SZ /d "%Name%" /f
reg add "HKLMSYSTEMCurrentControlSetServicesTcpipParameters" /v "NV Hostname" /t REG_SZ /d "%Name%" /f
reg add "HKLMSYSTEMCurrentControlSetServicesTcpipParameters" /v "Hostname" /t REG_SZ /d "%Name%" /f

 

HKEY_LOCAL_MACHINESystemCurrentControlSetControlComputerNameActiveComputerName
HKEY_LOCAL_MACHINESystemCurrentControlSetServicesTcpipParameters

echo 刷新注册表
if exist c:winnt (secedit /refreshpolicy machine_policy /enforce) else (gpupdate /force)

 

专门的学业组的修改能够通过二个wmic命令来完毕目标。

echo 修改专门的职业组
wmic computersystem where Name="%Name%" call JoinDomainOrWorkgroup Name="%Workgroup%"
wmic computersystem where Name="%ComputerName%" call JoinDomainOrWorkgroup Name="%Workgroup%"

通过修改注册表修改主机名和专门的工作组

wmic computersystem where Name="%COMPUTERNAME%" call JoinDomainOrWorkgroup Name="%WORKGROUP%"
现行反革命大家把它写成一个批管理,来落实无需重启修改Computer名和专门的职业组:

echo 修改IP
::查找MAC所对应的连日名称
for /f "tokens=1,2,3,4,5,6 delims=-" %%A in ("%MAC%") do set MacWMIC=%%A:%%B:%%C:%%D:%%E:%%F
for /f "skip=2 tokens=2* delims==" %%A in ('WMIC NIC WHERE "MACAddress='%MacWMIC%' AND NetConnectionID!=NULL" GET NetConnectionID /value') do set "ConnName=%%A"
if not defined ConnName set ConnName="本地连接"
netsh interface ip set address name="%ConnName%" source=static addr=%IP% mask=%mask%
netsh interface ip set address name="%ConnName%" gateway=%gway% gwmetric=0
netsh interface ip set dns name="%ConnName%" source=static addr=%dns% register=PRIMARY
netsh interface ip add dns name="%ConnName%" addr=%dns2% index=2
netsh interface ip set wins name="%ConnName%" source=static addr=none

@echo off
echo AppLife.Net
set /p name=请输您的Computer名:
reg add "HKEY_LOCAL_MACHINESystemCurrentControlSetControlComputerNameActiveComputerName" /v ComputerName /t reg_sz /d %name% /f >nul 2>nul
reg add "HKEY_LOCAL_MACHINESystemCurrentControlSetServicesTcpipParameters" /v "NV Hostname" /t reg_sz /d %name% /f >nul 2>nul
reg add "HKEY_LOCAL_MACHINESystemCurrentControlSetServicesTcpipParameters" /v Hostname /t reg_sz /d %name% /f >nul 2>nul
echo.
echo 修改Computer名达成
echo.
echo AppLife.Net
set /p work1=请输入您的办事组名:
wmic computersystem where Name="%COMPUTERNAME%" call JoinDomainOrWorkgroup Name="%work1%"
echo 修改职业组完毕
pause>nul
echo.

复制代码 代码如下:

echo arp绑定 %IP% %MAC%
arp -d
arp -s %IP% %MAC%
echo arp绑定网关 %gway%,若是互连网堵塞,将选择暗中认可网关的MAC:00-00-5e-00-01-01
ping -n 2 %gway%>nul 2>nul
if [%ERRORLEVEL%]==[1] (set GateMac=00-00-5e-00-01-01) else (
for /f "skip=3 tokens=2" %%H in ('arp -a %gway%') do set GateMac=%%H
)
cmd /c arp -s %gway% %GateMac%

 

@echo off
echo AppLife.Net
set /p name=请输您的计算机名:
reg add "HKEY_LOCAL_MACHINESystemCurrentControlSetControlComputerNameActiveComputerName" /v ComputerName /t reg_sz /d %name% /f >nul 2>nul
reg add "HKEY_LOCAL_MACHINESystemCurrentControlSetServicesTcpipParameters" /v "NV Hostname" /t reg_sz /d %name% /f >nul 2>nul
reg add "HKEY_LOCAL_MACHINESystemCurrentControlSetServicesTcpipParameters" /v Hostname /t reg_sz /d %name% /f >nul 2>nul
echo.
echo 修改Computer名完结
echo.
echo AppLife.Net
set /p work1=请输入您的干活组名:
wmic computersystem where Name="%COMPUTERNAME%" call JoinDomainOrWorkgroup Name="%work1%"
echo 修改职业组完成
pause>nul
echo.

for /l %%i in (3,-1,0) do ping -n 2 127.0.0.%%i>nul && @echo. %%i s 后重启计算机……
setlocal
cd/d %temp%
echo [version] > reboot.inf
set inf=InstallHinfSection DefaultInstall
echo signature=$chicago$ >> reboot.inf
echo [defaultinstall] >> reboot.inf
rundll32 setupapi,%inf% 1 %temp%reboot.inf
del reboot.inf
EXIT

无需重启

把位置的代码保存为三个bat文件,运转就能够了。

:newset
echo 您的机器或然是新机器,须要手工业输入ip
for /f "tokens=1,2 delims==" %%i in ('wmic bios get SerialNumber /value^|find "="') do set Name=%%j
if not defined Name set /p Name=请输入新机器的名字
echo 机器名:%Name%
call :select "Physical Address" "mac"
echo mac :%mac%
set /a aa=%random%%%9
set IP=168.30.7.1%aa%
set mask=255.255.0.0
set gway=168.30.1.233
set dns=168.1.4.147
set dns2=168.1.6.243
set Workgroup=vga00l
echo IP 配置: %ip% %mask% %gway% %dns% %dns2% %Workgroup%
for /l %%i in (5,-1,0) do ping -n 2 127.0.0.%%i>nul && @echo. %%i s 后修改机器名……
goto Enterset

:select
for /f "tokens=2 delims=:" %%i in ('ipconfig /all ^| findstr /i /c:%1') do if not "!%~2!" == "" set "%~2=%%i"
GOTO :eof

本文由金沙棋牌发布于操作系统,转载请注明出处:工作组的批处理金沙棋牌,计算机名

关键词:

上一篇:没有了

下一篇:没有了