2017-11-28 16 views
0

私のスクリプトは動作しますが、私は、リモートサーバーからのすべてのDHCPスコープ情報を取得しようとしています、私はスクリプトの取得DHCPスコープ

$A = "TestDH01" 
ForEach ($B in $A) { 

Get-DHCPServerv4Lease -ScopeID $_.ScopeID -AllLeases | where 
{$_.AddressState -like '*Reservation'} 

} Select-Object ScopeId,IPAddress,HostName,ClientID,AddressState | ExportCsv "\\TermServer\d$\New\Steve\$($A)-Reservations1.csv" -NoTypeInformation 

Get-DhcpServerv4Lease : Cannot validate argument on parameter 'ScopeId'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again. At line:4 char:36 + Get-DHCPServerv4Lease -ScopeID $.ScopeID -AllLeases | where {$. ... + ~~~~~~~~~~ + CategoryInfo : InvalidData: (:) [Get-DhcpServerv4Lease], ParameterBindingValidationException + FullyQualifiedErrorId : ParameterArgumentValidationError,Get-DhcpServerv4Lease

+0

あなたは '$ _'に何かをパイプしていないので、' $ _。ScopeID'は常にnullになります。 '-ScopeID $ B'のようなことをしてください – Nick

+0

少なくとも私には別のエラーがあります。 'ScopeID'は値" TestDH01 "を" System.Net.IPAddress "に変換できません。エラー:「無効なIPアドレスアドレスが指定されました」 – Slyons

+0

ScopeIDパラメータにはIPv4アドレスが必要で、アドレスリースの取得範囲を指定します。 – Nick

答えて

0

の下にエラーが表示された私は、あなたがしていると仮定しています

+1

それは感謝したニック – Slyons

関連する問題