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

WIMMount (HSM) causing cluster storage to go redirected (2012r2 DC)

Failed to delete the test record dcdiag-test-record in zone test.com

Azure MFA with Azure AD and RDS