首页 > 系统服务 > 详细

Powershell function to get all dhcp lease

时间:2016-02-16 15:06:35      阅读:255      评论:0      收藏:0      [点我收藏+]
  • 前提是安装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

原文:http://yoke88.blog.51cto.com/973273/1742419

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!