Can anyone provide advise pleaes !
I was wondering why below script not returning computer name variable when entered in write-output function
foreach($computer in (Get-Content "C:\scripts\servers1.txt")){
if(test-connection $computer -Count 2 -Quiet){
invoke-command -ComputerName $computer -ScriptBlock{
Get-NetAdapter | where status -eq 'up' | foreach{
Set-DNSClientServerAddress –interfaceIndex $_.ifIndex –ServerAddresses ("10.0.0.1","10.0.0.2") -Verbose
write-output "ip changed to '$computer' - $(get-date)"
}
}
}
else{
write-output "Unable to connect to '$computer' - $(get-date)"
}
}
Tareq dehneh