' ---------------------------------------------------------------
' rdo :
'      "Windows Server 2003 i Windows 2000. Receptury"
' Wydawca : HELION
' ISBN: 83-246-0063-9
' Adres: ftp://ftp.helion.pl/przyklady/ WSW2RE.zip
' ---------------------------------------------------------------

' ------ KONFIGURACJA SKRYPTU ------
strScope = "192.168.1.0"
strReservedIP = "192.168.1.6"
strMAC = "000102C8B474"
strClientName = "helion-wxp"
strClientComment = "Laptop szefa"
strServer = "" ' pozostaw puste jeeli konfigurujesz lokaln maszyn
' ------ KONIEC KONFIGURACJI ---------

strCommand = "netsh dhcp server " & strServer & " scope " & strScope & " add reservedip " & _
              strReservedIP & " " & strMAC & " " & strClientName & " """ & strClientComment & """"
' komenda: netsh dhcp server \\<ServerName> scope <ScopeID> add reservedip <ReservedIP> <MAC_Address> <ClientName> <ClientComment> 

WScript.Echo "Uruchamiam komend: " & strCommand
WScript.Echo
set objShell = CreateObject("Wscript.Shell")
set objProc  = objShell.Exec(strCommand)

Do
   WScript.Sleep 100
Loop Until objProc.Status <> 0

if objProc.ExitCode <> 0 then
   WScript.Echo "KOD WYJCIA: " & objProc.ExitCode
   WScript.Echo "BD: " & objProc.StdErr.ReadAll
end if

WScript.Echo "WYNIK: " & objProc.StdOut.ReadAll
