Hi,
I have a script that I parse the array, but I want to join the array into a string in the rverse order, but I have problems. Can anyone please help!
The code I have so far is as follows:
Dim strUserDN, strOU, strOUS
strUserDN = "CN=COMPUTERNAME,OU=MSCS,OU=Windows 2000,OU=Servers - OU,OU=Restricted,DC=MYDOMAIN,DC=COM"
Wscript.Echo Parse1(strUserDN)
Wscript.Echo Parse2(strUserDN)
Wscript.Echo Parse3(strUserDN)
strOUS = Parse2(strUserDN)
'Read into array
Dim arrOUList()
i = 0
For Each strOU in Split(strOUS, ",")
Redim Preserve arrOUList(i)
arrOUList(i) = Mid(strOU, InStr(strOU, "=") + 1)
i = i + 1
Next
'Read array in reverse order
k = 0
For k = Ubound(arrOUList) to LBound(arrOUList) Step - 1
Wscript.Echo arrOUList(k)
Next
MyArray = Join(arrOUList, "\")
Wscript.Echo MyArray
Function Parse1(strDN)
Parse1 = Mid(strDN, InStr(strDN, "=") + 1)
Parse1 = Mid(Parse1, InStr(Parse1, "=") + 1)
Parse1 = MId(Parse1, 1, InStr(Parse1, "=") - 4)
End Function
Function Parse2(strDN)
Parse2 = Mid(strDN, InStr(strDN, "=") + 1)
Parse2 = Mid(Parse2, InStr(Parse2, "=") - 2)
Parse2 = Left(Parse2, InStr(UCase(Parse2), "DC=") - 2)
End Function
Function Parse3(strDN)
Parse3 = Mid(strDN, InStr(strDN, "=") + 1)
Parse3 = Mid(Parse3, InStr(Parse3, "=") - 2)
End Function
Basically, I can read the array in the reverse order, but I do not know how to join the array items in the reverse order back into a string.
Thanks guys!
I have a script that I parse the array, but I want to join the array into a string in the rverse order, but I have problems. Can anyone please help!
The code I have so far is as follows:
Dim strUserDN, strOU, strOUS
strUserDN = "CN=COMPUTERNAME,OU=MSCS,OU=Windows 2000,OU=Servers - OU,OU=Restricted,DC=MYDOMAIN,DC=COM"
Wscript.Echo Parse1(strUserDN)
Wscript.Echo Parse2(strUserDN)
Wscript.Echo Parse3(strUserDN)
strOUS = Parse2(strUserDN)
'Read into array
Dim arrOUList()
i = 0
For Each strOU in Split(strOUS, ",")
Redim Preserve arrOUList(i)
arrOUList(i) = Mid(strOU, InStr(strOU, "=") + 1)
i = i + 1
Next
'Read array in reverse order
k = 0
For k = Ubound(arrOUList) to LBound(arrOUList) Step - 1
Wscript.Echo arrOUList(k)
Next
MyArray = Join(arrOUList, "\")
Wscript.Echo MyArray
Function Parse1(strDN)
Parse1 = Mid(strDN, InStr(strDN, "=") + 1)
Parse1 = Mid(Parse1, InStr(Parse1, "=") + 1)
Parse1 = MId(Parse1, 1, InStr(Parse1, "=") - 4)
End Function
Function Parse2(strDN)
Parse2 = Mid(strDN, InStr(strDN, "=") + 1)
Parse2 = Mid(Parse2, InStr(Parse2, "=") - 2)
Parse2 = Left(Parse2, InStr(UCase(Parse2), "DC=") - 2)
End Function
Function Parse3(strDN)
Parse3 = Mid(strDN, InStr(strDN, "=") + 1)
Parse3 = Mid(Parse3, InStr(Parse3, "=") - 2)
End Function
Basically, I can read the array in the reverse order, but I do not know how to join the array items in the reverse order back into a string.
Thanks guys!