Page 1 of 1 1
Topic Options
#49623 - 2000-04-25 08:41 AM Static to DHCP
Anonymous
Unregistered


Has anybody done a runonce
Static IP address to DHCP ??

Just on NT 4 Workstation.

Regards

Colin

Top
#49624 - 2000-04-25 09:33 AM Re: Static to DHCP
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Collin ,
did it once but can't find the code .....
investigating for it .... it was 2 projects ago....

if i ever find it on my private hdd's (junkyard) i'll post it here....

Cheers Jochen

_________________________



Top
#49625 - 2000-04-25 11:19 AM Re: Static to DHCP
Jack Lothian Offline
MM club member
*****

Registered: 1999-10-22
Posts: 1169
Loc: Ottawa,Ontario, Canada
I think Brainbuzz might have sample scripts for this.
_________________________
Jack

Top
#49626 - 2000-05-03 12:38 AM Re: Static to DHCP
Anonymous
Unregistered


I did save the code... here it is..

; Static IP to DHCP Conversion Custom Script [Begin]
if ingroup('DHCP-Conversion') and $ConnType='LAN'
$HKLM='HKEY_LOCAL_MACHINE'
$SCCSS='SYSTEM\CurrentControlSet\Services'
$Key='$HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\'
if $OStype='NT'
$Key=$Key+'Active'
endif
$Key=$Key+'ComputerName'
$ComputerName=readvalue('$Key','ComputerName')
$Index=0
if $OStype<>'NT' ; Win95/98 Routine
hcpLoop9x
$Key=enumkey('$HKLM\$SCCSS\Class\NetTrans\',$Index)
$Err=@ERROR
$DHCPEnabled=readvalue('$HKLM\$SCCSS\Class\NetTrans\$Key','IPAddress')
$Index=$Index+1
if $Err=0
if $DHCPEnabled<>'0.0.0.0'
; * Change from Static to DHCP *
$result=writevalue('$HKLM\$SCCSS\Class\NetTrans\$Key','IPAddress','0.0.0.0','REG_SZ')
$result=writevalue('$HKLM\$SCCSS\Class\NetTrans\$Key','IPMask','0.0.0.0','REG_SZ')
$result=delvalue('$HKLM\$SCCSS\Class\NetTrans\$Key','DefaultGateway')
; * Clear WINS, DNS, and Enable Use WINS for Windows DNS Resolution *
$result=writevalue('$HKLM\$SCCSS\VxD\MSTCP','EnableDNS','0','REG_SZ')
$result=delvalue('$HKLM\$SCCSS\VxD\MSTCP','NameServer')
$result=delvalue('$HKLM\$SCCSS\VxD\MSTCP','NameServer1')
$result=delvalue('$HKLM\$SCCSS\VxD\MSTCP','NameServer2')
$result=delvalue('$HKLM\$SCCSS\VxD\MSTCP','SearchList')
$result=delvalue('$HKLM\$SCCSS\VxD\MSTCP','Domain')
$result=delvalue('$HKLM\$SCCSS\VxD\MSTCP','NodeType')
$result=delvalue('$HKLM\$SCCSS\VxD\MSTCP','ScopeID')
$RestartFlag=2 ; 2=force reboot
endif
goto DhcpLoop9x
endif ; key enumeration complete
else ; NT Routine
if $NTtype<>'Server'
hcpLoopNT
$Key=enumkey('$HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkCards\',$Index)
$Err=@ERROR
$NicYN=0
$NicYN=readvalue('$HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkCards\$Key','Hidden')
if $NicYN=1
$Index=$Index+1
$NicYN=0
goto DhcpLoopNT
endif
$NicType=readvalue('$HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkCards\$Key','ServiceName')
$DHCPEnabled=readvalue('$HKLM\$SCCSS\$NicType\Parameters\TCPIP','EnableDHCP')
$Index=$Index+1
if $Err=0
if $DHCPEnabled<>'1'
; * Change from Static to DHCP *
$result=writevalue('$HKLM\$SCCSS\$NicType\Parameters\TCPIP','EnableDHCP','1','REG_DWORD')
$result=writevalue('$HKLM\$SCCSS\$NicType\Parameters\TCPIP','IPAddress','0.0.0.0','REG_MULTI_SZ')
$result=writevalue('$HKLM\$SCCSS\$NicType\Parameters\TCPIP','SubnetMask','0.0.0.0','REG_MULTI_SZ')
$result=writevalue('$HKLM\$SCCSS\$NicType\Parameters\TCPIP','DefaultGateway','','REG_MULTI_SZ')
$result=writevalue('$HKLM\$SCCSS\DHCP','Start','2','REG_DWORD')
; * Clear WINS, DNS, and Enable Use WINS for Windows DNS Resolution *
$result=writevalue('$HKLM\$SCCSS\NetBT\Adapters\$NicType','NameServer','','REG_SZ')
$result=writevalue('$HKLM\$SCCSS\NetBT\Adapters\$NicType','NameServerBackup','','REG_SZ')
$result=writevalue('$HKLM\$SCCSS\NetBT\Parameters','EnableDNS','1','REG_DWORD')
$result=writevalue('$HKLM\$SCCSS\TCPIP\Parameters','NameServer','','REG_SZ')
$result=writevalue('$HKLM\$SCCSS\TCPIP\Parameters','SearchList','','REG_SZ')
$result=writevalue('$HKLM\$SCCSS\TCPIP\Parameters','Domain','','REG_SZ')
$RestartFlag=2 ; 2=force reboot
endif
goto DhcpLoopNT
endif
endif ; key enumeration complete
endif ; not NT Server
if $RestartFlag>0
$result=messagebox('Your TCP/IP system settings have been converted to DHCP. Your system must be restarted for these changes to take effect.','ScriptLogic Notice',4112,60)
endif
endif ; ingroup
; Static IP to DHCP Conversion Custom Script [End]

Top
#49627 - 2000-05-03 01:45 AM Re: Static to DHCP
Anonymous
Unregistered


Thanks for the script...
Top
#49628 - 2000-05-04 04:25 AM Re: Static to DHCP
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
so.... no need to keep investigation ongoing
for me
_________________________



Top
#49629 - 2000-05-04 07:20 AM Re: Static to DHCP
Anonymous
Unregistered


The script is working great, with a nice shutdown and reboot....

When I login as a test user, that has NO Admin rights, NO changes are made (It reboots evertime...which is nice)

How do you allow non-Admins to run the script that change the registry settings ??

Or...How did you get around it ???

Ta Very much

Colin

Top
#49630 - 2000-05-06 11:19 AM Re: Static to DHCP
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Collin,
try to run the script with SU.exe (switch user ) -> reskit

Cheers

Jochen

_________________________



Top
#49631 - 2000-05-08 07:51 AM Re: Static to DHCP
Anonymous
Unregistered


Thanks...

I've played around with it and I've decided I'm really stupid as I cannot seem to get it to do anything..(Anything useful that is !!)

example

su <username> <domain> < <location of password text file> -n

I've tried lots (and lots) of variations.

Questions...

1. Do you run it in the if..endif that does the change of the registry settings?

2. Or can it sit outside?

3. Am I totally stupid??

4. Shall I become a road sweeper ??

All answers on a back of a postcard please !!!



Top
#49632 - 2000-05-08 09:09 AM Re: Static to DHCP
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
echo <password>|su <user> <command>

Very important that there is no space between <password> and the | (pipe) command.

in order for you to make the change with kix as a logon script, you will have to run the logon script with the su command.

or you can just shell out of the main logon script and run another kix script (with your reg changes) with the su command.....

shell "%comspec% /c echo <password>|su <user> %0\..\kix32 %0\..\regfix.kix"

or something like that


Bryce

[This message has been edited by Bryce (edited 08 May 2000).]

Top
#49633 - 2000-05-08 10:25 AM Re: Static to DHCP
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
does this satisfy the postcard order????


Jochen

_________________________



Top
#49634 - 2000-05-09 04:41 AM Re: Static to DHCP
Anonymous
Unregistered


Thanks Bryce & Jochen

tried the %compspec% line.

Now I get a RPC 1722 error
unable to find RPC server

Set Kix scipt to install suss.exe.
Use the Domain admin account & password.
Also tried local admin account.
My account.
The Pope's account (He was upset about that, had to do some Hail Mary's).

Any more advice ???

Top
#49635 - 2000-05-09 10:51 AM Re: Static to DHCP
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
this line should work for the shell command.

shell '%comspec% /c echo <password>|su <user> "kix32 script.kix"'


now, as for the error "unable to find RPC server", that is the error that you get when the suss.exe service isn't running. how did you install this service and is the service started?

Bryce

Top
#49636 - 2000-05-09 11:12 AM Re: Static to DHCP
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Bryce ,
i am not satisfied , You're too fast.
I CouldN'T post my solution (the same)

I will discontinue this thread ....

_________________________



Top
#49637 - 2000-05-10 02:34 AM Re: Static to DHCP
Anonymous
Unregistered


Hi Bryce

I've tried the updated %comspec% line.
A failure occurs at this point (DOS screen appears, the word FAILURE and some other words that I don't get the chance to read before the DOS screen closes)

The Kix32 file is located in the Winnt\System32 directory on all the PC's.

DHCPreg.kix is located on the DC's Netlogon share.

As for the suss.exe, this is copied over from the Netlogon share to the System32 directory.

Then the script runs a shell to do the suss.exe -install.

The problem seems to be;

1. The suss needs to be installed by an administrator.

2. The registry changes need to be done by an administrator.

So Suss can't be run from the login script as it won't be installed by a domain user account on the PC.

Su can't be run until suss has been installed.

Nice catch 22 situation....

Top
#49638 - 2000-05-10 09:14 AM Re: Static to DHCP
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
You are correct! This might be of some help
http://www.neosoft.com/~brycel/kix/other_scripts/

Take a look a the suss installer.

Bryce


Top
#49639 - 2000-11-29 08:16 AM Re: Static to DHCP
Anonymous
Unregistered


Just in case anyone else spends several hours trying to get this to work like I did here's a hint: if you are using bat2exec to convert your .bat to a .com then you MUST have a space after the pipe (|).
By the way has anyone managed to get a batch file with SET commands to convert to .com using bat2exec ?

------------------

Top
#49640 - 2000-11-29 05:04 PM Re: Static to DHCP
Roger Offline
Fresh Scripter

Registered: 2000-11-27
Posts: 26
Loc: Urbandale, IA USA
Hi Chris,

Where do you get bat2exe? Sounds like a useful tool.

Top
#49641 - 2000-11-29 05:11 PM Re: Static to DHCP
Anonymous
Unregistered


http://stratyx.dyndns.org/resources.htm

Or, do a search.....

Top
Page 1 of 1 1


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 867 anonymous users online.
Newest Members
JimDunn, fgarcia, Viginette, ManuvdWielNL, Sir_Barrington
17890 Registered Users

Generated in 0.067 seconds in which 0.024 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org