So I have been bashing my head on the KB trying to see whats best.
Using MDT / WDS to setup several BareBone machines that i have a list of, the hostnames, ip's and mac address. I can add this to a txt file, read the MAC address to the only connected NIC - compare it to the list in the txt file and then grab the variables to apply the correct hostname , IP's etc. MDT does not really have any Dynamic setting when applying hostname's and Nics. Anyone have a work around?
Sorta where i am
$CSV = import-csv "c:\Scripts\IPInfo.txt"
Foreach ($Item in $CSV)
{
$MAC = $Item.MacAddress
$MAC_CMD = (Get-WmiObject win32_networkadapterconfiguration -ComputerName $env:COMPUTERNAME | Where Macaddress -eq $MAC | Select-Object -Expand macaddress) -join ","
$MAC_Dash = $MAC_CMD -replace ":", "-"
#Write-host $MAC_DASH
$ActiveNic = Get-NetAdapter | where MacAddress -EQ $MAC_Dash | select -ExpandProperty name
#Write-Host "$ActiveNic"
#Write-Host "(in the loop) ip: $Computer"
if ($MAC_CMD -eq $Item.MacAddress){
$Computer = $Item.ComputerName
$IPaddress = $Item.IPAddress
$Subnet = $Item.SubnetMask
$GateWay = $Item.Gateway
$DNS1 = $Item.Dns1
$DNS2 = $Item.Dns2
}
}
Write-Host $ActiveNic
so far the txt has the following
computerName,IPAddress,SubnetMask,Gateway,Dns1,Dns2
devops-bg,10.1.0.57,255.255.255.0,10.1.0.1,10.1.0.18,10.1.0.13,
in theory, id like to grab the mac address of the "Active " nic and then compare that to the txt file