Page 1 of 2 12>
Topic Options
#103452 - 2003-08-06 07:31 PM How do I run NETDOM NT5 on NT4 to join AD domain
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Think there a a couple of members on the board here that have migrated NT4 workstations to Active Directory - specifically using NETDOM JOIN to do this.

Can anyone give me the reader's digest version of what needs to be installed on NT4 for NETDOM 2.0 (5?) to run ?

The only info I have is that NETDOM.EXE from the 2K resource kit is used, plus 2 or 3 extra DLL's that need to be either installed and/or registered ... anyone got the scoop on this or maybe a good link ?

-Shawn

[ 07. August 2003, 04:42: Message edited by: Shawn ]

Top
#103453 - 2003-08-06 08:40 PM Re: How do I run NETDOM NT5 on NT4 to join AD domain
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
hmmm, or is it even possible to do this ...
Top
#103454 - 2003-08-06 09:24 PM Re: How do I run NETDOM NT5 on NT4 to join AD domain
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
alrighty then [Big Grin] maybe I should step back and rephrase the question ... has anyone successfully been able to fully automate the migration of NT4 workstations into an Active Directory environment ... if so, how the heck did you do it ... [Wink]
Top
#103455 - 2003-08-06 09:32 PM Re: How do I run NETDOM NT5 on NT4 to join AD domain
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11628
Loc: CA
Shawn... sorry - bad news.

NETDOM is for 2000/XP/2003 systems. It does not seem to function properly for NT 4.0 systems.

We used NetIQ Migration tools for our systems, and another business unit used some tools from the BIND Corp.

However, there is ADSI code to enable you to perform this task on NT/2000/XP/2003 but I don't have the link right off hand, I'd have to search for it. Then you would need to convert it to KiXtart code.

Top
#103456 - 2003-08-06 10:22 PM Re: How do I run NETDOM NT5 on NT4 to join AD domain
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Yeah, but apparently there is a hack to get it to run on NT4 ... this is what I am trying to track down now ...
Top
#103457 - 2003-08-07 01:15 AM Re: How do I run NETDOM NT5 on NT4 to join AD domain
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11628
Loc: CA
Shawn,
Take a look at this link as well.

https://www.microsoft.c om/technet/treeview/default.asp?url=/technet/prodtechnol/windowsserver2003/proddocs/datacenter/dsadmin_computers_add_account.asp

https://www.microsoft.com/techn et/treeview/default.asp?url=/technet/prodtechnol/windowsserver2003/proddocs/datacenter/DS_command_line_tools.asp

Here is a converted piece of code to add Workstations, but I don't think it handles NT 4 workstations necessarily.

Don't forget to hit up Howard on this as well. He works for a Company that absorbs a lot of smaller Companies, so he may have another method as well.

code:
$strComputer = 'ABC-TEST'
$ADS_UF_PASSWD_NOTREQD = '&h0020'
$ADS_UF_WORKSTATION_TRUST_ACCOUNT = '&h1000'

$objRootDSE = GetObject('LDAP://rootDSE')
$objContainer = GetObject('LDAP://OU=Computers,DC=mycompany,DC=com')

$objComputer = $objContainer.Create("Computer", "cn=" + $strComputer)
$objComputer.Put ("sAMAccountName", $strComputer + '$')
? 'Adding Computer Account error was: '+@ERROR+' - '+@SERROR
$objComputer.Put ("userAccountControl", $ADS_UF_PASSWD_NOTREQD Or $ADS_UF_WORKSTATION_TRUST_ACCOUNT)
? 'Adding Account Control error was: '+@ERROR+' - '+@SERROR
$objComputer.SetInfo

Sorry about the code mess. Forgot that General is not HTML enabled.

[ 07. August 2003, 01:29: Message edited by: NTDOC ]

Top
#103458 - 2003-08-07 01:22 AM Re: How do I run NETDOM NT5 on NT4 to join AD domain
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
There are old NT4 versions of NetDom and new ones as well. IMHO, NetDom is not the tool of choice to migrate from NT4. NetIQ is the preferred choice and ADMT2 is a close cousin.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#103459 - 2003-08-07 01:23 AM Re: How do I run NETDOM NT5 on NT4 to join AD domain
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Hey bud. I will read the code when you clean it up alittle [Wink] thanks for the links too !

Heres the scoop. The information I recieved about there being a hack for NETDOM and NT4 was incorrect. I have it from good authority that NETDOM 5 will not (under any circumstances) run under NT4 ... this I proved myself today, by replacing some key DLL's and having the machine blue screen on me on reboot [Wink] (true).

Just by way of some background, we want to write a script that will be pushed to our NT4 workstations (by Tivoli) and have the workstations automatically joing AD *and* join into the proper workstation OU.

This is my plan then ... NETDOM 1.8 will run on NT4 and it will join an NT4 workstation to the AD domain - however, 1.8 does not support the /OU switch ... 1.8 will join the wkstn to the default OU for computers only. Figure that with a little bit of KIX/ADSI scripting, can have the wkstn perform a AD move from the default OU to its HOME OU ... will have to provide credentials to ADSI to do this, we will see how reliable that is.

Plus, have also heard rumours that NETDOM 1.8's JOINDOMAIN feature is (to put it mildy) un-reliable [Frown]

[ 07. August 2003, 01:23: Message edited by: Shawn ]

Top
#103460 - 2003-08-07 01:30 AM Re: How do I run NETDOM NT5 on NT4 to join AD domain
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11628
Loc: CA
Shawn,

Your method is very doable as normal users can add workstations to the AD Domain by default.

You could then run scripts to move Computers to specific OUs.

However,
The user using NETDOM would need to still have Local Admin rights.

Top
#103461 - 2003-08-07 01:40 AM Re: How do I run NETDOM NT5 on NT4 to join AD domain
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Well, I will have access to a priviledged AD domain account during the install (nuff said about that here) ... dont think that will be an issue other than whether or not it will work and be reliable ... plan on providing the credentials to the NETDOM and OpenDSObject I guess. In terms of normal users being able to add computers to the domain, from what I understand, a user has only 10 (ten) free tokens to do this. After that, manual intervention is required. We are rolling-out to hundreds of machines a night, spanning 1000's of machines over a few weeks. Pretty sure these freebies will be used up pretty quick (unless I'm mis-understanding this) ...

-Shawn

[ 07. August 2003, 01:42: Message edited by: Shawn ]

Top
#103462 - 2003-08-07 01:44 AM Re: How do I run NETDOM NT5 on NT4 to join AD domain
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
That's 10 freebees per joe blow user. I disabled that one right away. Don't want joe blow users adding computers. If you have a special account setup it can join unlimited computers.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#103463 - 2003-08-07 01:48 AM Re: How do I run NETDOM NT5 on NT4 to join AD domain
krabourn Offline
Hey THIS is FUN
*****

Registered: 2000-12-11
Posts: 244
Loc: San Antonio, Texas, USA
Shawn, I sent you an email. We are running scripts to create the account in the right OU and then sending a netdom SMS package to add to the domain. It seems to work pretty well.
_________________________
Kelly

Top
#103464 - 2003-08-07 02:10 AM Re: How do I run NETDOM NT5 on NT4 to join AD domain
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Kelly, is this for Windows NT workstations ? Im not at home (working late on this) can you give me a small description of what tools your using ? netdom ? adsi ?
Top
#103465 - 2003-08-07 02:27 AM Re: How do I run NETDOM NT5 on NT4 to join AD domain
krabourn Offline
Hey THIS is FUN
*****

Registered: 2000-12-11
Posts: 244
Loc: San Antonio, Texas, USA
The script uses ADSI to create accounts. It is nothing really new. It is based off Create Computer Account from Technet's Script Center. I had to write it quickly, so I went back to my console roots. I wrote it to be menu driven and it logs itself. I was just thinking you could quickly modify it for your needs.
_________________________
Kelly

Top
#103466 - 2003-08-07 02:36 AM Re: How do I run NETDOM NT5 on NT4 to join AD domain
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Guess the big question is, will that code run on a workstation that is NT4 *and* that is not already joined to the domain. In other words, sounds like a bit of a chicken and egg thing. Is this script an "admin" script that runs on an adminstrators wkstn that is already joined to the domain, and that creates a computer account ?
Top
#103467 - 2003-08-07 02:39 AM Re: How do I run NETDOM NT5 on NT4 to join AD domain
krabourn Offline
Hey THIS is FUN
*****

Registered: 2000-12-11
Posts: 244
Loc: San Antonio, Texas, USA
Keep the snickering down. Most of this is old code that I slapped together.

code:
;=====================================================================
;=== NAME: Create Computer Account in OU in Active Directory
;=== Version: 1.01
;=== Date: 07/28/2003
;=== Author: Kelly Rabourn
;===
;===
;=== This will Create a computer account in the chosen OU in
;=== Active Directory.
;===
;=== This WILL NOT create a computer account IF:
;=== The computer already exists IN Active Directory.
;=== You do not permission to add to the selected OU.
;=== The computer shows Gone.
;===
;=====================================================================
BREAK ON

;--- Variables for creating and showing information
$Width = 79
$Height = 24
$Title = "Add Computers to OU"
$Nul = SetTitle ($Title)
$HeaderMaster = "Computer" + Chr(9) + "Ping Status" + Chr(9) + "Add OU Code" +
Chr(9) + "Add OU Status" + Chr(9) + "Computer OU" + Chr(9) + "Add To OU" +
Chr(9) + "Started at " + @Date + " - " + @Time

;--- Output Files
$FileMaster = ".\Add-PC-Active Directory.txt"

;--- Input Files
$LineIn = ''
$FileComputers = ".\Computers.txt"

IF NOT Exist ($FileComputers)
EXIT 1
ENDIF

;*** CHANGE ME
$ADOU = ",OU=Workstations,DC=name,DC=company,DC=com"
$ComputerOU = ""
$ComputerOUCode = ""
$ComputerOUStatus = ""

$Title = "Select a Office Type"
$Ttitle2 = "Press the Excape key to exit."
$ChoiceKeys = "C","O"
$Choices = "CDT","(ODT)"
$SelectOfficeType = Ucase(fnPopupMenu($Title,$Ttitle2,$Choices,$ChoiceKeys,25,10))
SELECT
CASE $SelectOfficeType = "C"
$ADOU = ",OU=CorporateDesktop" + $ADOU
$Title = "Select a CDT OU"
$Ttitle2 = "Press the Excape key to exit."
$ChoiceKeys = "A","B","C","D","E","F","G","H","I","J","K","L","M"
$Choices = "Connecticut (CDT)","Illinois (CDT)","Indiana (CDT)",
"Michigan (CDT)","Ohio (CDT)","Wisconsin (CDT)","Arkansas (CDT)",
"Kansas (CDT)","Missouri (CDT)","Oklahoma (CDT)","Texas (CDT)",
"California (CDT)","Nevada (CDT)"
$SelectOU = Ucase(fnPopupMenu($Title,$Ttitle2,$Choices,$ChoiceKeys,25,6))
SELECT
CASE $SelectOU = "A"
$ADOU = "OU=CT,OU=EAST" + $ADOU
CASE $SelectOU = "B"
$ADOU = "OU=IL,OU=GREATLAKES" + $ADOU
CASE $SelectOU = "C"
$ADOU = "OU=IN,OU=GREATLAKES" + $ADOU
CASE $SelectOU = "D"
$ADOU = "OU=MI,OU=GREATLAKES" + $ADOU
CASE $SelectOU = "E"
$ADOU = "OU=OH,OU=GREATLAKES" + $ADOU
CASE $SelectOU = "F"
$ADOU = "OU=WI,OU=GREATLAKES" + $ADOU
CASE $SelectOU = "G"
$ADOU = "OU=AR,OU=MIDWEST" + $ADOU
CASE $SelectOU = "H"
$ADOU = "OU=KS,OU=MIDWEST" + $ADOU
CASE $SelectOU = "I"
$ADOU = "OU=MO,OU=MIDWEST" + $ADOU
CASE $SelectOU = "J"
$ADOU = "OU=OK,OU=MIDWEST" + $ADOU
CASE $SelectOU = "K"
$ADOU = "OU=TX,OU=MIDWEST" + $ADOU
CASE $SelectOU = "L"
$ADOU = "OU=CA,OU=WEST" + $ADOU
CASE $SelectOU = "M"
$ADOU = "OU=NV,OU=WEST" + $ADOU
ENDSELECT
CASE $SelectOfficeType = "O"
$ADOU = ",OU=OperationalDesktop" + $ADOU
$Title = "Select a ODT OU"
$Ttitle2 = "Press the Excape key to exit."
$ChoiceKeys = "A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P"
$Choices = "Illinois (ODT)","Indiana (ODT)","Michigan (ODT)","Ohio (ODT)",
"Wisconsin (ODT)","California (ODT)","Central West Texas (ODT)",
"Dallas (ODT)","Houston (ODT)","Kansas City (ODT)","Little Rock (ODT)",
"Oklahoma City (ODT)","San Antonio (ODT)","St Louis (ODT)","West (ODT)",
"SNET (ODT)"
$SelectOU = Ucase(fnPopupMenu($Title,$Ttitle2,$Choices,$ChoiceKeys,25,4))
SELECT
CASE $SelectOU = "A"
$ADOU = "OU=IL,OU=AIT" + $ADOU
CASE $SelectOU = "B"
$ADOU = "OU=IN,OU=AIT" + $ADOU
CASE $SelectOU = "C"
$ADOU = "OU=MI,OU=AIT" + $ADOU
CASE $SelectOU = "D"
$ADOU = "OU=OH,OU=AIT" + $ADOU
CASE $SelectOU = "E"
$ADOU = "OU=WI,OU=AIT" + $ADOU
CASE $SelectOU = "F"
$ADOU = "OU=CAL,OU=MODS" + $ADOU
CASE $SelectOU = "G"
$ADOU = "OU=CWT,OU=MODS" + $ADOU
CASE $SelectOU = "H"
$ADOU = "OU=DLS,OU=MODS" + $ADOU
CASE $SelectOU = "I"
$ADOU = "OU=HOU,OU=MODS" + $ADOU
CASE $SelectOU = "J"
$ADOU = "OU=KCY,OU=MODS" + $ADOU
CASE $SelectOU = "K"
$ADOU = "OU=LTR,OU=MODS" + $ADOU
CASE $SelectOU = "L"
$ADOU = "OU=OKC,OU=MODS" + $ADOU
CASE $SelectOU = "M"
$ADOU = "OU=SAN,OU=MODS" + $ADOU
CASE $SelectOU = "N"
$ADOU = "OU=STL,OU=MODS" + $ADOU
CASE $SelectOU = "O"
$ADOU = "OU=ODWEST" + $ADOU
CASE $SelectOU = "P"
$ADOU = "OU=SNET" + $ADOU
ENDSELECT
ENDSELECT

IF $SelectOfficeType = "" OR $SelectOU = ""
GOTO "End"
ENDIF

CLS

IF Open (1, $FileComputers) = 0
$Row = 18
GOSUB "ClearScreen"
$Computer = Trim(ReadLine (1))
DO
$Nul = fnPingQuick($Computer, 1, 1000, 32, 128)
$Result = @Error
SELECT
CASE $Result < 3
SELECT
CASE $Result = 0
$StatusPing = "On"
CASE $Result = 1
$StatusPing = "Slow"
CASE $Result = 2
$StatusPing = "Off"
ENDSELECT
$objComputer = fnADSearch($Computer,,"Computer")
FOR EACH $instComputer IN $objComputer
$ComputerOU = Split($instComputer, "AccountName")[0]
NEXT
IF $ComputerOU = ""
$ADS_UF_PASSWD_NOTREQD = &20
$ADS_UF_WORKSTATION_TRUST_ACCOUNT = &1000
$objContainer = GetObject("LDAP://" + $ADOU)
$objComputer = $objContainer.Create("Computer", "cn=" + $Computer)
$objComputer.Put ("sAMAccountName", $Computer + "$")
$objComputer.Put ("userAccountControl", $ADS_UF_PASSWD_NOTREQD)
$objComputer.Put ("userAccountControl", $ADS_UF_WORKSTATION_TRUST_ACCOUNT)
$objComputer.SetInfo
$objComputer.SetPassword (Lcase($Computer) + "$")
$ComputerOUCode = fnConvertCOMerror(@Error)
$ComputerOUStatus = @SError
ELSE
$ComputerOUCode = 9
$ComputerOUStatus = "Exists"
ENDIF
CASE $Result = 3
$StatusPing = "Gone"
ENDSELECT
$LineOut = $Computer + Chr(9) + $StatusPing + Chr(9) + $ComputerOUCode + Chr(9) +
$ComputerOUStatus + Chr(9) + $ComputerOU + Chr(9) + $ADOU
GOSUB ShowInfo
$Row = $Row - 1
$FileOut = $FileMaster
$RC = fnWriteFile($FileOut, $LineOut, $HeaderMaster)
$ComputerOU = ""
$ComputerOUCode = ""
$ComputerOUStatus = ""
$Computer = Trim(ReadLine (1))
UNTIL @Error <> 0
$RC = Close (1)
ENDIF

:End
COLOR w/n
QUIT 1

:ClearScreen
;--- This will clear the screen and show the title.
COLOR b/b
CLS
COLOR r+/b
At ($Height - $Height, ($Width - Len($Title)) / 2 )
$Title
RETURN

:ShowInfo
;--- This will show the information on the screen.
IF $Row = 1
$Row = 18
GOSUB ClearScreen
ENDIF
COLOR y+/b
At ($Height - 19, 0)
"Computer Ping Err Code Err Status Computer OU New OU"
COLOR w/b
At ($Height - $Row, 0)
$Computer
At ($Height - $Row, 17)
$StatusPing
At ($Height - $Row, 25)
$ComputerOUCode
At ($Height - $Row, 33)
Left($ComputerOUStatus, 11)
At ($Height - $Row, 45)
Left($ComputerOU, 17)
At ($Height - $Row, 63)
Left($ADOU, 16)
GOSUB "HideInfo"
RETURN

:HideInfo
;This will hide information from the screen.
COLOR b/b
$Nul = At ($Height - 22, 0)
RETURN

;================================================================
FUNCTION fnWriteFile($FileName, $LineOut, OPTIONAL $HeaderLine)
;--- This will write a line of text to a file.
IF NOT Exist ($FileName) AND $HeaderLine <> ""
$RC = Open (10, $FileName, 5)
$RC = WriteLine (10, $HeaderLine + @CRLF)
$RC = Close (10)
ENDIF
IF $LineOut <> ""
$RC = Open (10, $FileName, 5)
$RC = WriteLine (10, $Lineout + @CRLF)
$RC = Close (10)
$fnWriteFile = 0
ELSE
$fnWriteFile = 1
ENDIF
ENDFUNCTION
;================================================================
FUNCTION fnPopupQuestion($PopupPrompt, OPTIONAL $PopupSecondPrompt, $PopupX, $PopupY,
OPTIONAL $PopupUserWidth, OPTIONAL $PopupUserHeight)

DIM $PopupQuestionErr, $PopupKey, $PopupHeight, $PopupWidth
$PopupQuestionErr = 0
$fnPopupQuestion = ""
IF $PopupUserHeight = ""
IF $PopupSecondPrompt = ""
$PopupSecondPrompt = "Press the Escape key to exit."
ENDIF
$PopupHeight = 3
ELSE
$PopupHeight = $PopupUserHeight
ENDIF
IF $PopupUserWidth = ""
IF Len ($PopupPrompt) > Len ($PopupSecondPrompt)
$PopupWidth = Len ($PopupPrompt)
ELSE
$PopupWidth = Len ($PopupSecondPrompt)
ENDIF
ELSE
$PopupWidth = $PopupUserWidth
ENDIF
$PopupWidth = $PopupWidth + 2
COLOR w+/b
$Nul = Box ($PopupY, $PopupX, $PopupY + $PopupHeight, $PopupX + $PopupWidth, "single")
$Nul = At ($PopupY, $PopupX + 1)
Substr ($PopupPrompt, 1, $PopupWidth - 2)
$Nul = At ($PopupY + $PopupHeight, $PopupX + 1)
$Nul = Substr ($PopupSecondPrompt, 1, $PopupWidth - 2)
$Nul = At ($PopupY + 1, $PopupX + 1)
DO
GET $PopupKey
IF $PopupKey <> Chr (224)
SELECT
CASE $PopupKey = Chr (27)
$fnPopupQuestion = ""
$PopupQuestionErr = 1
GOTO PopupQuestionExit
CASE $PopupKey = Chr (13) AND $fnPopupQuestion = ""
$fnPopupQuestion = ""
$PopupQuestionErr = 0
GOTO PopupQuestionExit
CASE $PopupKey = Chr (8)
$fnPopupQuestion = Substr($fnPopupQuestion, 1, Len($fnPopupQuestion) - 1) + " "
At ($PopupY + 1, $PopupX + 1)
$fnPopupQuestion
$fnPopupQuestion = Substr($fnPopupQuestion, 1, Len($fnPopupQuestion) - 1)
At ($PopupY + 1, $PopupX + 1)
$fnPopupQuestion
$PopupKey = ""
CASE 1
IF $PopupKey <> Chr (13)
$fnPopupQuestion = $fnPopupQuestion + $PopupKey
ENDIF
ENDSELECT
$PopupKey
ELSE
GET $PopupKey
ENDIF
UNTIL $PopupKey = Chr (13) or $PopupKey = Chr (27) ; CR,ESC ?
:PopupQuestionExit
EXIT $PopupQuestionErr
ENDFUNCTION
;================================================================
FUNCTION fnPopupMenu($PopupPrompt, OPTIONAL $PopupSecondPrompt, $PopupItems,
OPTIONAL $PopupItemKeys, $PopupX, $PopupY)

DIM $PopupMenuError, $PopupOption, $PopupN, $PopupCurrent, $PopupPrevious
DIM $PopupKey, $PopupHeight, $PopupWidth
$PopupMenuError = 0
$fnPopupMenu = ""
IF VarTypeName($PopupItems) <> "variant[]"
$PopupMenuError = @Error
GOTO PopupMenuEnd
ENDIF
$PopupHeight = UBound ($PopupItems) + 2
$PopupWidth = Len ($PopupPrompt)
IF $PopupSecondPrompt = ""
$PopupSecondPrompt = "Press the Escape key to exit."
ENDIF
IF Len ($PopupSecondPrompt) > $PopupWidth
$PopupWidth = Len ($PopupSecondPrompt)
ENDIF
FOR EACH $PopupOption IN $PopupItems
IF Len ($PopupOption) > $PopupWidth
$PopupWidth = Len ($PopupOption)
ENDIF
NEXT

$PopupWidth = $PopupWidth + 2
COLOR w+/b
Box ($PopupY, $PopupX, $PopupY + $PopupHeight, $PopupX + $PopupWidth, "single")
At ($PopupY, $PopupX + 1)
Substr ($PopupPrompt, 1, $PopupWidth - 2)
At ($PopupY + $PopupHeight, $PopupX + 1)
Substr ($PopupSecondPrompt, 1, $PopupWidth - 2)
$PopupN = 0
$PopupOption = 0
FOR EACH $PopupOption IN $PopupItems
At ($PopupY + $PopupN + 1, $PopupX + 1)
IF VarTypeName($PopupItemKeys) = "variant[]"
COLOR w+/b
$PopupItemKeys[$PopupN]
" "
ENDIF
COLOR w/b
$PopupOption
$PopupN =$PopupN + 1
NEXT
$PopupCurrent = 0
$PopupPrevious = $PopupCurrent
COLOR b/w+
At ($PopupY + $PopupCurrent + 1, $PopupX + 1)
IF VarTypeName($PopupItemKeys) = "variant[]"
$PopupItemKeys[$PopupCurrent]
" "
ENDIF
$PopupItems[$PopupCurrent]

DO
At ($PopupY + 1, $PopupX + $PopupWidth - 1)
COLOR b/b
GET $PopupKey
FOR EACH $ItemKey IN $PopupItemKeys
IF $ItemKey = $PopupKey
$fnPopupMenu = $PopupKey
GOTO PopupMenuEnd
ENDIF
NEXT
IF $PopupKey = Chr (224) ; Extended Key
GET $PopupKey
IF $PopupKey = Chr (80) ; Down Arrow
$PopupCurrent = $PopupCurrent + 1
IF $PopupCurrent = UBound ($PopupItems) + 1
$PopupCurrent = 0
ENDIF
ENDIF
IF $PopupKey = Chr (72) ; Up Arrow
$PopupCurrent = $PopupCurrent - 1
IF $PopupCurrent = -1
$PopupCurrent = UBound ($PopupItems)
ENDIF
ENDIF
IF $PopupCurrent <> $PopupPrevious
COLOR b/w+
At ($PopupY + $PopupCurrent + 1, $PopupX + 1)
IF VarTypeName($PopupItemKeys) = "variant[]"
$PopupItemKeys[$PopupCurrent]
" "
ENDIF
$PopupItems[$PopupCurrent]

At ($PopupY + $PopupPrevious + 1, $PopupX + 1)
IF VarTypeName($PopupItemKeys) = "variant[]"
COLOR w+/b
$PopupItemKeys[$PopupPrevious]
" "
ENDIF
COLOR w/b
$PopupItems[$PopupPrevious]
ENDIF
$PopupPrevious = $PopupCurrent
ENDIF
IF $PopupKey = Chr (13)
IF VarTypeName($PopupItemKeys) = "variant[]"
$fnPopupMenu = $PopupItemKeys[$PopupCurrent]
ELSE
$fnPopupMenu = $PopupItems[$PopupCurrent]
ENDIF
ENDIF
UNTIL $PopupKey = Chr (13) OR $PopupKey = Chr (27) ; CR,ESC ?
:PopupMenuEnd
COLOR b/b
Box ($PopupY, $PopupX, $PopupY + $PopupHeight, $PopupX + $PopupWidth, "full")
COLOR w/n
EXIT $PopupMenuError
ENDFUNCTION
;================================================================
FUNCTION fnPingQuick($Address, OPTIONAL $PingCount, OPTIONAL $PingWait,
OPTIONAL $PacketSize, OPTIONAL $PingTTL)

;----------------------------------------------------------------
;--- This function will Ping an address and return an error code
;--- , an IP address and an IP host name.
;--- 0 - The address is on.
;--- 1 - The address is a slow link, such as RAS/ISDN/VPN.
;--- 2 - The address is off.
;--- 3 - The address does not exist.
;----------------------------------------------------------------
GLOBAL $IPAddress, $IPName, $IPError, $IPAvgTime, $IPLinkSpeed
DIM $WshShell, $oExec, $IPTime, $IPErrorCode, $PingLine, $Index1, $Index2
DIM $Index3, $Index4
$IPAddress = ""
$IPName = ""
$IPError = "Unknown error"
$IPErrorCode = 3
IF $PingCount = ""
$PingCount = 4
ENDIF
IF $PingWait = ""
$PingWait = 4000
ENDIF
IF $PacketSize = ""
$PacketSize = 32
ENDIF
IF $PingTTL = ""
$PingTTL = 128
ENDIF
$IPTime = ""
$WshShell = CreateObject ("WScript.Shell")
$oExec = $WshShell.Exec ("%Comspec% /e:1024 /C ping -a -n " + $PingCount +
" -w " + $PingWait + " -l " + $PacketSize + " -i " + $PingTTL + " " + $Address)
WHILE NOT $oExec.StdOut.AtEndOfStream
$PingLine = $oExec.StdOut.ReadLine
SELECT
CASE InStr ($PingLine, "Pinging ")
$IPError = "Pinging"
$Index1 = 9
IF InStr ($PingLine, "[")
IF InStr ($Address, ".")
$Index2 = InStr ($PingLine, ".")
ELSE
$Index2 = InStr ($PingLine, "[") - 1
ENDIF
$Index3 = InStr ($PingLine, "[") + 1
$Index4 = InStr ($PingLine, "]")
$IPName = Substr ($PingLine, $Index1, $Index2 - $Index1)
$IPAddress = Substr ($PingLine, $Index3, $Index4 - $Index3)
ELSE
$IPAddress = ""
$IPName = ""
ENDIF
CASE InStr ($PingLine, "TTL expired in transit")
$IPError = "TTL expired in transit"
$IPErrorCode = 2
CASE InStr ($PingLine, "TTL expired during reassembly")
$IPError = "TTL expired during reassembly"
$IPErrorCode = 2
CASE InStr ($PingLine, "Request timed out")
$IPError = "Request timed out"
$IPErrorCode = 2
CASE InStr ($PingLine, "host unreachable")
$IPError = "host unreachable"
$IPErrorCode = 2
CASE InStr ($PingLine, "net unreachable")
$IPError = "net unreachable"
$IPErrorCode = 3
CASE InStr ($PingLine, "protocol unreachable")
$IPError = "protocol unreachable"
$IPErrorCode = 3
CASE InStr ($PingLine, "port unreachable")
$IPError = "port unreachable"
$IPErrorCode = 3
CASE InStr ($PingLine, "Bad")
$IPError = "Bad"
$IPErrorCode = 3
CASE InStr ($PingLine, "Unknown host")
$IPError = "Unknown host"
$IPErrorCode = 3
CASE InStr ($PingLine, "Reply from")
$IPError = "Reply from"
$IPErrorCode = 0
ENDSELECT
$PingLine = ReadLine(10)
LOOP
$PingLineQuick = $IPError
EXIT $IPErrorCode
ENDFUNCTION
;================================================================
FUNCTION fnADSearch(OPTIONAL $ADFullName, OPTIONAL $ADAccountName, OPTIONAL $ObjectType)
DIM $AdoCon
DIM $AdoCommand
DIM $Recordset
DIM $Filter
DIM $i
SELECT
CASE Len($ADFullName) > 0 AND Len($ADAccountName) > 0
$filter = " where cn='" + $adfullname + "' and samAccountName='" + $ADAccountName + "' "
CASE Len($ADFullName) > 0
$filter = " where cn='" + $ADFullName + "' "
CASE Len($ADAccountName) > 0
$filter = " where samAccountName='" + $ADAccountName + "' "
CASE 1
; I'm sure you don't want to retreive the complete Active Directory database
RETURN
ENDSELECT
IF Len($ObjectType) > 0
$filter = $filter + "and objectCategory='" + $ObjectType + "' "
ENDIF
$AdoCon = CreateObject("ADODB.Connection")
$AdoCon.Provider = "ADsDSOObject"
; Current credentials are used, as username and password aren't specified
$AdoCon.Open("Active Directory Provider")
; Create ADO command object for the connection.
$AdoCommand = CreateObject("ADODB.Command")
$AdoCommand.ActiveConnection = $AdoCon
$AdoCommand.CommandText = "Select AdsPath, samAccountName, GroupType,
ObjectCategory from 'LDAP://" + GetObject("LDAP://rootDSE").Get("defaultNamingContext") +
"' " + $filter
; Execute the query.
$Recordset = $AdoCommand.Execute
IF @Error=0
; $Recordset is 1 based
IF $Recordset.RecordCount > 0
REDIM $fnADSearch[$recordset.RecordCount - 1]
$Recordset.movefirst
FOR $i = 0 TO $recordset.RecordCount - 1
; Here we'll parse the fields of the current record
$fnADSearch[$i] = Substr($Recordset.Fields("AdsPath").value, 8) ; To get rid of " LDAP://"
$fnADSearch[$i] = $fnADSearch[$i] + ",AccountName=" + $Recordset.Fields("samAccountName").value + ","
IF Len($Recordset.Fields("samAccountName").value) > 0
$fnADSearch[$i] = $fnADSearch[$i] + "IsContainer=0,"
ELSE
$fnADSearch[$i] = $fnADSearch[$i] + "IsContainer=1,"
ENDIF
IF Len($Recordset.Fields("Grouptype").value) > 0
$fnADSearch[$i] = $fnADSearch[$i] + "IsGroup=1"
ELSE
$fnADSearch[$i] = $fnADSearch[$i] + "IsGroup=0"
ENDIF ; Moving to the next record we have in $Recordset
$Recordset.Movenext
NEXT
ENDIF
ENDIF
ENDFUNCTION
;================================================================
FUNCTION fnConvertCOMerror($COMError)
;--- This will convert a COM error to a understandable error code.
$fnConvertCOMerror = Val ("&" + Right (DecToHex ($COMError), 4))
EXIT $fnConvertCOMerror
ENDFUNCTION
;================================================================

;$objComputer = GetObject("LDAP://CN=" + $strComputer + ",OU=TX,OU=MIDWEST,
; OU=CorporateDesktop,OU=Workstations,DC=name,DC=company,DC=com")
;$objComputer.DeleteObject(0)



[ 07. August 2003, 05:10: Message edited by: krabourn ]
_________________________
Kelly

Top
#103468 - 2003-08-07 02:41 AM Re: How do I run NETDOM NT5 on NT4 to join AD domain
krabourn Offline
Hey THIS is FUN
*****

Registered: 2000-12-11
Posts: 244
Loc: San Antonio, Texas, USA
This is an Admin script. You sit at your computer and create accounts.
_________________________
Kelly

Top
#103469 - 2003-08-07 02:42 AM Re: How do I run NETDOM NT5 on NT4 to join AD domain
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
No snickering here - really appreciate the help - printing this off for the long (long) late bus ride home ... will review then [Wink] ... hopefully respond in a few hours if your still around.

btw, really appreciate the help on this guys !

Top
#103470 - 2003-08-07 04:20 AM Re: How do I run NETDOM NT5 on NT4 to join AD domain
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Kelly,

Would really like to take a peek at the SMS
package you run on the workstation [Wink]

Top
#103471 - 2003-08-07 04:26 AM Re: How do I run NETDOM NT5 on NT4 to join AD domain
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11628
Loc: CA
Kelly,

LONG LINE POLICE [Eek!]

I know it's a pain, but could you break up the long lines.
I think this thread may continue on and long lines make it difficult to read.

SMS Package:
EXE OR ZIP with kix32 or wkix32 and script included with autorun. Or, could even run a simple batch file against any server using the Admin rights of SMS

Top
Page 1 of 2 12>


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

Who's Online
0 registered and 1003 anonymous users online.
Newest Members
StuTheCoder, M_Moore, BeeEm, min_seow, Audio
17884 Registered Users

Generated in 0.074 seconds in which 0.029 seconds were spent on a total of 13 queries. Zlib compression enabled.

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