WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

ADSI
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Bad Path Error in NT 4

Keywords: 	 Bad Path Error in NT 4

Question:

When I run the following code on the domain controller, it will move a specified computer from "CN=Computers" to "OU=Desktops,OU=Workstations" or "OU=Laptops,OU=Workstations", but when I run it from a NT workstation in the domain, I get a bad path error.

(w2kroot is a domain admin, dsIsObject commands show that Adsi_Desktops is a valid object, and Adsi_MyComputer_Computers shows that the computer is in the CN=Computers container.)

Any suggestions?


;---------------------------------------------
; Add Extenders
;---------------------------------------------
AddExtender("wwctl34I.dll") ;Used for Dialogs
AddExtender("WWWNT34I.DLL") ;Used for Accounts
AddExtender("wwads34I.DLL") ;Used for ADSI

Title_Bar_Text = "O/S Tuning"
COMPUTERNAME = "CRAZY8"
Domain_Name = "w2ktest"

;---------------------------------------------
; ADSI User Info
;---------------------------------------------
adsi_act = "w2kroot@%Domain_Name%"
adsi_pwd = "xxxx"

dsSetCredent(adsi_act, adsi_pwd)

Adsi_Desktops =
"LDAP://w2ktest/OU=Desktops,OU=Workstations,DC=Test,DC=spawar,DC=navy,DC=mil"
Adsi_Laptops =
"LDAP://w2ktest/OU=Laptops,OU=Workstations,DC=Test,DC=spawar,DC=navy,DC=mil"

Adsi_MyComputer_Computers =
"LDAP://w2ktest/CN=%COMPUTERNAME%,CN=Computers,DC=Test,DC=spawar,DC=navy,DC=mil"
Adsi_MyComputer_Desktops =
"LDAP://w2ktest/CN=%COMPUTERNAME%,OU=Desktops,OU=Workstations,DC=Test,DC=spawar,DC=navy,DC=mil"
Adsi_MyComputer_Laptops =
"LDAP://w2ktest/CN=%COMPUTERNAME%,OU=Laptops,OU=Workstations,DC=Test,DC=spawar,DC=navy,DC=mil"


CompTypeFormat=`WWWDLGED,5.0`
CompTypeCaption=Title_Bar_Text
CompTypeX=-1
CompTypeY=-1
CompTypeWidth=110
CompTypeHeight=61
CompTypeNumControls=4
CompType01=`20,40,70,DEFAULT,PUSHBUTTON,DEFAULT,"OK",1`
CompType02=`5,2,76,DEFAULT,STATICTEXT,DEFAULT,"Select the type of computer:"`
CompType03=`10,15,900,DEFAULT,RADIOBUTTON,Computer_Type,"Desktop",1`
CompType04=`10,25,90,DEFAULT,RADIOBUTTON,Computer_Type,"Laptop",2`

ButtonPushed=Dialog("CompType")

if Computer_Type == 1
Adsi_Target = Adsi_Desktops
Adsi_MyComputer_Target = Adsi_MyComputer_Desktops
Target = "Desktops"
else
Adsi_Target = Adsi_Laptops
Adsi_MyComputer_Target = Adsi_MyComputer_Laptops
Target = "Laptops"
EndIf

if dsIsObject(Adsi_Desktops) then Message("Desktop container valid",Adsi_Desktops)
if dsIsObject(Adsi_Laptops) then Message("Laptop container valid",Adsi_Laptops)

if dsIsObject(Adsi_MyComputer_Computers) then Message("%COMPUTERNAME% exists in
Computers",Adsi_MyComputer_Computers)
if dsIsObject(Adsi_MyComputer_Desktops) then Message("%COMPUTERNAME% exists in
Desktops",Adsi_MyComputer_Desktops)
if dsIsObject(Adsi_MyComputer_Laptops) then Message("%COMPUTERNAME% exists in
Laptops",Adsi_MyComputer_Laptops)


if dsIsObject(Adsi_MyComputer_Target)
Message(Title_Bar_Text,"%COMPUTERNAME% is already in the %Target% container.")
else
if dsIsObject(Adsi_MyComputer_Computers)
dsMoveObj(Adsi_MyComputer_Computers, Adsi_Target,"")
Message(Title_Bar_Text,"%COMPUTERNAME% has been moved to the %Target% container.")
else
Message(Title_Bar_Text,"%COMPUTERNAME% is NOT in the Computers container.")
EndIf ;Adsi_MyComputer_Computers
EndIf ;Adsi_MyComputer_Target

Answer:

Assuming you meant an NT 4.0 workstation and not a Win2k workstation, there are a couple of problems. (Your script worked just fine from one of our Win2k workstation.)
  1. For reasons that are not completely clear the NT 4.0 Dsclient providers sometimes have a hard time finding LDAP servers by domain name. You can get around this problem by substituting the name of the domain controller computer for the domain name. For example, if your domain name is "grey" and the domain controller's name is "birch", change the path from "LDAP://GREY/" to "LDAP://BIRCH/".

  2. Active directory will not always accept alternate credentials when offered by our extender running on a NT 4.0 machine. The work around is to create a domain user on the domain controller with the same name and password as the user on the NT 4.0 machine. Do this instead of using the dsCredent function provided by the extender. Also, the created domain user account must have sufficient privileges to preform the desired operation.

    At this time it is not clear whether or not the dsCredent behavior is a problem with our extender or a problem with the client software. When I have more information, I will post it here.

  3. Finally, it appears that in order for dsCredent to work properly on an NT 4.0 workstation, the user name parameter must be changed to conform to NT 4.0 semantics. For example, assuming the "Grey" domain, the user name from a Win2k workstation might be "Admin@grey.windowware.com" and "grey\Admin" on an NT 4.0 workstation. If you want to make a script portable, you can use the WIL WinVersion(2) function to determine the Windows version and therefore user name semantics at run time.

Article ID:   W14508
Filename:   Bad Path Error on NT4.txt
File Created: 2001:03:02:14:39:48
Last Updated: 2001:03:02:14:39:48