$base=((Get-NetIPConfiguration | Where-Object IPv4DefaultGateway | Select-Object -First 1).IPv4Address.IPAddress -replace '\d+$',''); 1..254 | ForEach-Object { $ip="$base$_"; if(Test-Path "\\$ip\ADMIN$" -ErrorAction SilentlyContinue){[pscustomobject]@{IP=$ip;Name=(try{[Net.Dns]::GetHostEntry($ip).HostName}catch{''});AdminShare='OK'}} } | Format-Table -AutoSize