【发布时间】:2018-04-10 19:42:03
【问题描述】:
所以我还有另一个基本的 PowerShell 东西,我还不够先进,无法弄清楚。我有几个脚本用于在 AD 中查找信息(一个是我从描述字段中提供信息,另一个是我输入计算机编号)我想要从 DHCP 中提取 IP 地址租约。我需要从那里拉它以解决 MS Surface 设备问题。我还有 2 台服务器需要轮询 IP 租约......
我已经开始了,但我得到了非常复杂的结果
$scopes = Get-DhcpServerv4Scope -ComputerName 'XXXXXXX- need to have 2 here if possible XXXX'
foreach($scope in $scopes)
{
#write-host "The current scope name is:" $scope.name -ForegroundColor Red
$lease = Get-DhcpServerv4Lease -ComputerName 'XXXXXXX- need to have 2 here if possible XXXX' -ScopeId $scope.ScopeId
#$lease
}
$pro = @{'name'=$scope.Name;'ipaddress'=$lease.IPAddress;'ScopeId'=$lease.ScopeId;'ClientId'=$lease.ClientId} | Format-Table
$obj = New-Object -TypeName psobject -Property $pro
$obj | Format-Table
我知道我没有很好地解释这一点 - 但最终我想输入一个计算机号码并让它提取 AD 信息,然后进入 DHCP 并提取租约。
【问题讨论】:
标签: powershell dhcp