I use csvde to extract data that looks like:
101000081,"CN=Czuchry\\, Michael L.,OU=psy,OU=Depts,DC=company,DC=com"
101000164,"CN=Loud\\, John,OU=lan,OU=Depts,DC=company,DC=com"
etc.
I read that into a VBscript and then based on other criteria, I want to
disable and then move the appropriate user accounts. That section of my
code looks like this:
************************
1 If status = "notactive" Then
2 strADsPath = "LDAP://" & objRecordset.Fields.Item("DN")
3 wscript.echo strADsPath
4 Set objUser = GetObject(strADsPath)
5 wscript.echo objUser
6
7 UAC = objUser.Get("userAccountControl")
8
9 objUser.Put "userAccountControl", UAC OR ADS_UF_ACCOUNTDISABLE
10 objUser.SetInfo
11
12 Set objOU =
GetObject("LDAP://ou=Mail1Disables,ou=ToBeDeleted,dc=company,dc=com")
13 objOU.MoveHere strADsPath, vbNullString
14 End if
The problem is when line 2 tries to build the correct AD path, it sticks the
two \\ characters which is invalid:
LDAP://CN=Loud\\, John,OU=lan,OU=Depts,DC=tcu,DC=edu
C:\scripts\smooth.vbs(63, 5) (null): An invalid dn syntax has been
specified.
How can I convert the \\ to just \ which is the true DN?
I suppose csvde is esc'ing the single DN during its output, but that's such
a huge pain to deal with.
I also realize I shouldn't have to do the csvde export at all, I should be
able to query all the users in AD directly and set variables for them, but I
haven't learned how to do that yet.