Question : Novell DHCP DB migration to Windows DHCP

Hello

We are currently in the process of migrating Novell DHCP to Windows DHCP. I cant find any tool which will easily migrate the Novell Database (which can be exported) to the Windows DHCP Server.

The only way i can find is to create some sort of scripts which formats the novell database to netsh windows command line. I cant find any tool for this and i am not good at perl scripting. I found this script on a blog and it does not work for me either. It gives me the following errors:

ERROR #1 with the Script:
c:\>dhcpscript.pl
Can't modify constant item in scalar assignment at C:\dhcpscript.pl line 1, ne
"use" not allowed in expression at C:\dhcpscript.pl line 11, at end of line
syntax error at C:\dhcpscript.pl line 11, near "use strict"
BEGIN not safe after errors--compilation aborted at C:\dhcpscript.pl line 12.


ERROR#2
After removing the [code='perl'] from the first line (i dont know just tried it, i get the following error]:

c:\>dhcpscript.pl
syntax error at C:\dhcpscript.pl line 28, near "= )"
Global symbol "$line" requires explicit package name at C:\dhcpscript.pl line 29.
syntax error at C:\dhcpscript.pl line 33, near "= ) "
Global symbol "$entry" requires explicit package name at C:\dhcpscript.pl line 35.
Global symbol "$entry" requires explicit package name at C:\dhcpscript.pl line 38.
Global symbol "$entry" requires explicit package name at C:\dhcpscript.pl line 41.
Global symbol "$entry" requires explicit package name at C:\dhcpscript.pl line 44.
syntax error at C:\dhcpscript.pl line 47, near "}"
Global symbol "$entry" requires explicit package name at C:\dhcpscript.pl line 48.
syntax error at C:\dhcpscript.pl line 59, near "}"
C:\dhcpscript.pl has too many errors.

Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
[code='perl']
#!C:\Perl\bin\perl.exe
 
# Designed to read in Rservations from a Novell DHCP Tab file and output a NetSH script file
# From http://technet.microsoft.com/en-us/library/cc787375.aspx
# On the destination server, the exec command is used to load and execute the converted reservations:
# netsh exec AdReservations.txt
# After you use the exec command to load the file, you must reconcile all scopes.
# Use net stop dhcpserver to stop the DHCP Server service and net start dhcpserver to restart it. Once the service is restarted, DHCP database changes take effect.
 
use strict; 
use warnings;
 
my $dhcptabName = "DHCP3TAB.txt";
my $outFile = "AdReservations.txt";
my @dhcpServers = ('\\\\kalimdor');
my $scopeName = "172.21.0.0";
 
open F, "< $dhcptabName" or die "Can't open $dhcptabName : $!";
open O, "> $outFile" or die "Can't open $outFile : $!";
 
# File parsing
my $ip;
my $host;
my $mac;
my $type;
my $comment="";
 
while (my $line = ){
if ($line =~ /^\[IP Address Configuration /i) {
# New entry, clear values
$ip="", $host="", $mac="", $type="", $comment="";
 
while ((my $entry = ) !~ /^$/){
# Parse and fill in values
if ($entry =~ /IP Address Number = ([\d.]+)/i){
$ip=$1;
}
elsif ($entry =~ /Assignment Type = (\d+)/i){
$type=$1;
}
elsif ($entry =~ /Host Name = ([\w\-_]+)/i){
$host=$1;
}
elsif ($entry =~ /MAC Address = 1 (.+)/i){
$mac=$1;
$mac=~ s/\s+//g;
}
elsif ($entry =~ /Comment = (.+)/i){
$comment=$1;
}
}
 
# If type != 8 (reservation) discard
next unless ($type == 8);
next if ($mac eq "" or $ip eq "" or $host eq "");
foreach my $server (@dhcpServers){
print O "Dhcp Server $server Scope $scopeName Add reservedip $ip $mac \"$host\" \"$comment\" \"BOTH\"\n";
}
}
}
close O;
close F;
[/code]

Answer : Novell DHCP DB migration to Windows DHCP

Can you post DHCP3TAB.txt's content?

I believe the script is missing at the following places, but I can't be sure unless I see what's in that file.

while (my $line = )

while ((my $entry = )  !~ /^$/)
Random Solutions  
 
programming4us programming4us