PowerShell - DHCP Server List
Get-DhcpServerInDC
DHCP Server List with
OS
$DHCPServers = Get-DhcpServerInDC
ForEach ($DHCPServer in $DHCPServers){
$OSInfo
= Get-CIMInstance
-ComputerName $DHCPServer.DnsName -ClassName
Win32_OperatingSystem
}
ForEach ($DHCPServer
in $DHCPServers){
$OSInfo
= Get-CIMInstance
-ComputerName $DHCPServer.DnsName -ClassName
Win32_OperatingSystem
[pscustomobject]@{
ServerName =
$DHCPServer.DnsName;
IPAddress=$DHCPServer.IpAddress;
OS=$OSInfo.Caption
}
}
No comments:
Post a Comment