千家信息网

win10加域

发表于:2025-12-02 作者:千家信息网编辑
千家信息网最后更新 2025年12月02日,<#文件:domain.ps1用途:用于加域功能脚本#>#修改计算机名Rename-Computer -NewName hz#添加DNSGet-DnsClientServerAddress -Addr
千家信息网最后更新 2025年12月02日win10加域

<#

文件:domain.ps1

用途:用于加域功能脚本

#>


#修改计算机名

Rename-Computer -NewName hz


#添加DNS

Get-DnsClientServerAddress -AddressFamily IPv4 |Out-GridView -PassThru |foreach { Set-DnsClientServerAddress -InterfaceIndex $_.InterfaceIndex -Addresses '192.168.3.200'}

ifconfig /flushdns


#加域

$domain = "company"

$password = ConvertTo-SecureString "qwe123!@#" -AsPlainText -Force

$username = "$domain\ad"

$credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $username, $password

Add-Computer -DomainName $domain -Credential $credential


#重启电脑

Restart-Computer


0