简体   繁体   English

仅使用 Powershell 获取 DHCP 服务器地址,如 ipconfig /all

[英]Get DHCP Server address with only Powershell, like ipconfig /all

Get-NetIPConfiguration doesn't show DHCP server's ip address information. Get-NetIPConfiguration不显示 DHCP 服务器的 ip 地址信息。 How can I do same as ipconfig /all but with PowerShell native tools?除了使用 PowerShell 本机工具外,我怎样才能与 ipconfig /all 一样?

Use this:用这个:

Get-CimInstance Win32_NetworkAdapterConfiguration -Filter "DHCPEnabled=$true" | Select DHCPServer

if you use Windows 7 / 2008 R2 or below:如果您使用 Windows 7 / 2008 R2 或以下版本:

Get-WMIObject Win32_NetworkAdapterConfiguration -Filter "DHCPEnabled=$true" | Select DHCPServer

Both will retrieve only interface with DHCP enabled, remove the filter if you want them all两者都将只检索启用了 DHCP 的接口,如果你想要它们全部删除过滤器

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM