Powershell function to get all dhcp lease
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Powershell function to get all dhcp lease相关的知识,希望对你有一定的参考价值。
- 前提是安装RSAT tool for win10,这样才有相应的powershell module 来管理DHCP
- 另外要有权限来查询DHCP服务器
加入下面代码到$profile 中
function get-dhcplease{ $dhcpservers=Get-DhcpServerInDC $dhcpscopes=$dhcpservers|%{$computername=$_.dnsname;Get-DhcpServerv4Scope -ComputerName $computername|%{$_|Add-Member -Type NoteProperty -name "computername" -Value $computername;$_}} $dhcpscopes|%{Get-DhcpServerv4Lease -ScopeId $_.scopeid -ComputerName $_.computername}|Out-GridView }
然后执行. $profile
get-dhcplease可以查询目前域内所有DHCP服务器的IP分发。
以上是关于Powershell function to get all dhcp lease的主要内容,如果未能解决你的问题,请参考以下文章
back-to-basics-generational-garbage-collection
[powershell]Use powershell to get file hash / 使用powershell获取文件哈希值
powershell sql-to-sql powershell bulkcopy import speedtest
powershell https://win32.io/posts/How-To-Find-Text-PowerShell
powershell 来自https://stackoverflow.com/questions/1663748/powershell-analog-to-quote-words