Looking for a site of each DCHP server

38 Views Asked by At

I got a list of DHCP servers and I need to find a site and an operating system for each server, but it either fails or runs in loop if I write -filter *:

$servers = Get-Content -Path 'C:\users\user\Desktop\Has connection.txt'
foreach($server in $servers) {
    Get-ADReplicationSite -filter operatingsystem,site
}
1

There are 1 best solutions below

0
Erik Andersson On

You're not calling the -Server parameter and it looks like you want to get the properties "operatingsystem,site"? In that case use -Properties instead like this:

$servers = Get-Content -Path 'C:\users\user\Desktop\Has connection.txt'
foreach($server in $servers){

   Get-ADReplicationSite -Server $server -Properties operatingsystem,site
}