如何通过WMI获得dhcp租约到期时间?

问题描述 投票:0回答:1

现在我将Get-DhcpServerv4Lease -ComputerName 'pc' -ScopeId 'id' -AllLeases$object.leaseExpiryTime结合使用以获取租约到期时间。

但是可以通过WMI查询获得它吗?请问您一个例子。

powershell wmi dhcp
1个回答
0
投票

使用Win32_NetworkAdapterConfiguration,因为它确实包含DHCPLeaseExpires。例如,

gwmi -query "select DHCPLeaseExpires, ipaddress, Description from Win32_NetworkAdapterConfiguration where dhcpleaseexpires is not null"
# Output
Description      : Intel(R) Dual Band Wireless-AC 8265
DHCPLeaseExpires : 20200604032809.000000+180
IPAddress        : {192.168.1.104, fe80::...}
© www.soinside.com 2019 - 2024. All rights reserved.