Im so confused there is a lot in this. I think I bit off more than I can chew can you have a look at the script bellow and advice me what im doing wrong or what im leaving out… sorry to bother you but im just not that good at kix
Code:
**************************************************************************************************************
**************************************************************************************************************
;FUNCTION TranslateName()
**************************************************************************************************************
**************************************************************************************************************
Function TranslateName ($InitType, $BindName, $LookupNameType, $LookupName, $ReturnNameType)
Dim $InitType, $BindName, $LookupNameType, $LookupName, $ReturnNameType
Dim $NameTranslate, $ReturnName, $Error, $ErrorText
$Error = 0
$ErrorText = ""
$ReturnName = ""
$NameTranslate = CREATEOBJECT ("NameTranslate")
$Error = @error
$ErrorText = @serror
if $Error = 0
$NameTranslate.Init ($InitType, $BindName)
$Error = @error
$ErrorText = @serror
if $Error = 0
$NameTranslate.Set ($LookupNameType, $LookupName)
$Error = @error
$ErrorText = @serror
if $Error = 0
$ReturnName = $NameTranslate.Get($ReturnNameType)
$Error = @error
$ErrorText = @serror
endif
endif
endif
$TranslateName = $ReturnName, $Error, $ErrorText
Endfunction
****************************************************************************************************
****************************************************************************************************
; InContainer() - Determines if the current account or computer is in a container
****************************************************************************************************
****************************************************************************************************
Function InContainer ("OU=Users,OU=Information Technology,OU=Dublin,DC=lab,DC=iconcr,DC=com", "Users")
Dim $Container, $CurrentContainer, $NameType, $Name1, $Name2
select
case $NameType = "Computer" $Name1 = "@Domain\@wksta$"
case $NameType = "User" $Name1 = "@LDomain\@UserID"
case 1 $Name1 = ""
endselect
if $Name1 <> ""
$Name2 = TranslateName (3, "", 3, $Name1, 1)
if $Name2[1] = 0
$CurrentContainer = substr($Name2[0], instr($Name2[0], ",")+1)
select
case $rc[0]=1 ? "object is a member of the specified container."
case $CurrentContainer=$Container $InContainer = 1, $Name2[1], $Name2[2]
case instr($Name2[0], $Container) $InContainer = 2, $Name2[1], $Name2[2]
case 1 $InContainer = 0, $Name2[1], $Name2[2]
endselect
else
$InContainer = -2, $Name2[1], $Name2[2]
endif
else
$InContainer = -1, 0, ""
endif
EndFunction
****************************************************************************************************
****************************************************************************************************
Dim $UsersOU
$UsersOU = InContainer('OU=Users,OU=Information Technology,OU=Dublin,DC=lab,DC=iconcr,DC=com','User')
If $UsersOU[0]=1
? 'T: (\\shortts\DATA)'
Use T: '\\shortts\DATA'
Else
? 'User was not found in the Users, Information Technology OU or some other error'
EndIf
any help Appreciated