need help converting this to powershell


can in converting ps?

@echo off

/f "tokens=1-4 delims=," %%g in (dhcp-reservations.txt) (

netsh dhcp server 10.200.1.6 scope %%g add reservedip %%h %%i %%j "" both
netsh dhcp server 10.200.1.6 scope %%g set reservedoptionvalue %%h 66 string "10.200.1.20"
netsh dhcp server 10.200.1.6 scope %%g set reservedoptionvalue %%h 67 string "pxelinux.0"
)

if correct to $txt = $_ -split ',' split each line in text file comma , store array $txt.

if dhcp server running windows server 2012 or later can use add-dhcpserverv4reservation , set-dhcpserverv4optionvalue create reservations , set options.



Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

Generating Event ID 91, 44 with CA (In Event Viewer with source as Certsvc)

Group policy default policy cannot be edited because network name not found

Problem when changing update source