Function Rename-Computer( $NewName,$AutoRestart=$false )
{
$computer=Get-WMIObject Win32_ComputerSystem
$computer.Rename( $NewName ) | out-null
if($AutoRestart) { Restart-Computer -Force }
}


$prefx="192.168.0."
$ipaddress = 7..9
Foreach ($sn in $ipaddress)
{
Rename-Computer ZSSH_$ip
netsh interface ip set address "无线网络连接" static 192.168.0.$sn 255.255.255.0 192.168.0.1
netsh interface ip set dns "无线网络连接" static 192.168.0.1
netsh interface ip add dns "无线网络连接" 8.8.4.4
#add-computer -domain "域名" -cred "域名\授权用户" -passthru
$IP=$prefx+$sn
Write-Output "$sn,$IP" >> D:\ServerIPList.txt

}

相关文章:

  • 2021-04-30
  • 2022-02-14
  • 2021-12-07
  • 2021-09-26
  • 2022-02-07
  • 2021-10-07
  • 2021-09-02
  • 2021-05-18
猜你喜欢
  • 2022-12-23
  • 2021-07-01
  • 2022-01-04
  • 2022-12-23
  • 2021-12-25
  • 2022-01-23
  • 2021-11-27
相关资源
相似解决方案