Auto-commit: 2025-10-31 08:58:35
This commit is contained in:
26
Domain-Integrate-commandline/SetDns.ps1
Normal file
26
Domain-Integrate-commandline/SetDns.ps1
Normal file
@@ -0,0 +1,26 @@
|
||||
# Detect Active Card
|
||||
$CarteUP = ""
|
||||
$Cards = Get-NetAdapter
|
||||
foreach ($Card in $Cards) {
|
||||
if (($Card.Status -eq "Up") -and ($Card.Name -notlike "*VMware*" )) {
|
||||
if (($CarteUP -eq "") -or ($CarteUP -like"*wi")) {
|
||||
$CarteUP = $Card.Name
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Detect Index Card
|
||||
$IndexCarte = ""
|
||||
$indexCards = Get-NetIPInterface
|
||||
foreach ($indexCard in $indexCards) {
|
||||
if (($indexCard.InterfaceAlias -eq "$CarteUP") -and ($indexCard.AddressFamily -eq "IPv4")) {
|
||||
$IndexCarte = $IndexCard.ifIndex
|
||||
$DHCPCarte = $IndexCard.DHCP
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Set-DnsClientServerAddress -InterfaceIndex $IndexCarte -ServerAddresses ("192.168.0.210")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user