알쓸신잡 Powershell 스크립트 모음10
[Explanation]
##DHCP 서버에서 scope 대역 및 Exclusive 대역 정보 확인 하는 파워쉘[System.Collections.ArrayList]$ArrayList =$ip
$ip=Get-Content C:\Users\Administrator\Desktop\Site_IP.txt
$count=$ip.Count-1
for($a=0;$a -le $count ; $a++){
$scope=Get-DhcpServerv4Scope -ScopeId $ip[$a]
$checkscope=Get-DhcpServerv4ExclusionRange -ScopeId $ip[$a]
$scope_start=$scope.StartRange
$scope_end=$scope.EndRange
$scope_exclusive_start=$checkscope.StartRange
$scope_exclusive_end=$checkscope.EndRange
$scopeip=$ip[$a]
if($scope -eq $null){
Write-Output "$scopeip : Not enrolled " | out-file C:\Users\Administrator\Desktop\dhcp_check.txt -Append #Export-Csv C:\Users\Administrator\Desktop\dhcp_check.csv -Encoding UTF8 -Append
}else{
Write-Output "$scopeip : $scope_start~$scope_end ($scope_exclusive_start~ $scope_exclusive_end )" | out-file C:\Users\Administrator\Desktop\dhcp_check.txt -Append #Export-Csv C:\Users\Administrator\Desktop\dhcp_check.csv -Encoding UTF8 -Append
}
}
##예시
10.202.5.0 : Not enrolled
10.202.6.0 : Not enrolled
10.202.7.0 : 10.202.7.51~10.202.7.254 (~ )
10.202.8.0 : Not enrolled
10.202.9.0 : 10.202.9.31~10.202.9.254 (10.202.9.31~ 10.202.9.150 )
10.202.10.0 : Not enrolled
10.202.11.0 : Not enrolled
10.207.169.0 : Not enrolled
10.207.170.0 : 10.207.170.11~10.207.170.254 (~ )
♔♔♔♔♔♔♔♔♔♔
댓글이나 의견은 언제든지 환영합니다.
Your Comments are Always Welcomed!
0 comments:
Post a Comment