利用Powershell 脚本,Windows DHCP服务器获取计算机名称及对应Mac地址
param(
[string]$DBServer=$(throw "please input dbserver ip"),
[string]$Database=$(throw "please input db"),
[string]$user=$(throw "please input db user"),
[string]$password= $(throw "please input db passwd"),
[string]$dhcpid= $(throw "please input dhcp computerName") #一个集团会有多个Site,每个Site都可能会有Dhcp服务器
)
$dhcpLease = Get-DhcpServerv4Scope | Get-DhcpServerv4Lease
$leaseDict = @{
}
foreach ( $l in $dhcpLease )
{
$dict = @{