dhcp에서 powershell을 통해 범위를 설정하고 정보를 txt 파일로 내보내려고합니다. 내 코드는 필요한 작업을 수행하지만 txtfile로 내보낼 때 | out 파일은 ip-range 및 exclude-range가 아닌 예약 된 ip 만 내 보냅니다.powershell에서 txt 파일로 내보내기
#scherm leegmaken
Clear-Host
#import module dhcp server
Import-Module DHCPServer
#DHCP service oppstarten
Set-service dhcpserver –startuptype automatic
Start-service dhcpserver
#Een scope aanmaken
netsh dhcp server 192.168.126.140 add scope 192.168.126.0 255.255.255.0 "Scope1"
#de iprange van de scope meegeven
netsh dhcp server 192.168.126.140 scope 192.168.126.0 add iprange 192.168.126.160 192.168.126.199
#de excluderange meegeven
netsh dhcp server 192.168.126.140 scope 192.168.126.0 add excluderange 192.168.126.180 192.168.126.189
#Een ip reserveren
netsh dhcp server 192.168.126.140 scope 192.168.126.0 add reservedip 192.168.126.182 f8db7f4fa490 "reservationEx1"
#de iprange, ecluderange en het gereserveerde ip weerrgeven en wegschrijven naar txt file
netsh DHCP server \\W2K12PWSHLL01 scope '192.168.126.0' show iprange +
netsh DHCP server \\W2K12PWSHLL01 scope '192.168.126.0' show excluderange +
netsh DHCP server \\W2K12PWSHLL01 scope '192.168.126.0' show reservedip | Out-File "C:\TEMP\Ballali.DHCPConfigInfo.11792.txt"