|
server
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
LDAP query fails... because of parentheses?Hello all. I'm using the script found here: http://www.microsoft.com/technet/scriptcenter/resources/qanda/apr05/hey0419.mspx When I run it, as it cycles through all the members of the Group, if the "strUser" variable is something like this: CN=Smith\, John,CN=Users,DC=Name1,DC=ad,DC=Name2,DC=com ....there's no problem. But when the "strUser" variable is this: CN=Doe\, Jane (LIFE U/W),CN=Users,DC=Name1,DC=ad,DC=Name2,DC=com Then the script blows up, on this line: Set objMember = GetObject("LDAP://" & strUser) With this error message: (null): 0x80005000 The obvious difference is that the strUser variable in question contains parentheses. Anyone know a fix for this? Any help would be greatly appreciated. Thanks! - Dave
Show quote
Hide quote
"Highlander" <tron9***@msn.com> wrote in message I believe the problem is actually the forward slash. AD does not require news:043c069b-cc9c-45df-b7bd-f1fb2ef91626@z1g2000yqn.googlegroups.com... > (watch for word wrap below) > > Hello all. > > I'm using the script found here: > http://www.microsoft.com/technet/scriptcenter/resources/qanda/apr05/hey0419.mspx > > When I run it, as it cycles through all the members of the Group, if > the "strUser" variable is something like this: > CN=Smith\, John,CN=Users,DC=Name1,DC=ad,DC=Name2,DC=com > > ...there's no problem. > > But when the "strUser" variable is this: > CN=Doe\, Jane (LIFE U/W),CN=Users,DC=Name1,DC=ad,DC=Name2,DC=com > > Then the script blows up, on this line: > Set objMember = GetObject("LDAP://" & strUser) > > With this error message: > (null): 0x80005000 > > The obvious difference is that the strUser variable in question > contains parentheses. Anyone know a fix for this? > > Any help would be greatly appreciated. Thanks! > > - Dave that this be escaped, but ADSI does. Both open and close parantheses are fine. Escape the forward slash with the backslash escape character, just as you escape the comma. For example: CN=Doe\, Jane (LIFE U\/W),CN=Users,DC=Name1,DC=ad,DC=Name2,DC=com If you are retrieving the DN from some IADs method, all characters that need to be escaped, will be escaped, except for the forward slash. In my programs I use code similar to: strUserDN = Replace(strUserDN, "/", "\/")
Show quote
Hide quote
"Richard Mueller [MVP]" <rlmueller-nospam@ameritech.nospam.net> wrote in From the link you provided, replace this:message news:uMLJLFqlJHA.3760@TK2MSFTNGP03.phx.gbl... > > "Highlander" <tron9***@msn.com> wrote in message > news:043c069b-cc9c-45df-b7bd-f1fb2ef91626@z1g2000yqn.googlegroups.com... >> (watch for word wrap below) >> >> Hello all. >> >> I'm using the script found here: >> http://www.microsoft.com/technet/scriptcenter/resources/qanda/apr05/hey0419.mspx >> >> When I run it, as it cycles through all the members of the Group, if >> the "strUser" variable is something like this: >> CN=Smith\, John,CN=Users,DC=Name1,DC=ad,DC=Name2,DC=com >> >> ...there's no problem. >> >> But when the "strUser" variable is this: >> CN=Doe\, Jane (LIFE U/W),CN=Users,DC=Name1,DC=ad,DC=Name2,DC=com >> >> Then the script blows up, on this line: >> Set objMember = GetObject("LDAP://" & strUser) >> >> With this error message: >> (null): 0x80005000 >> >> The obvious difference is that the strUser variable in question >> contains parentheses. Anyone know a fix for this? >> >> Any help would be greatly appreciated. Thanks! >> >> - Dave > > I believe the problem is actually the forward slash. AD does not require > that this be escaped, but ADSI does. Both open and close parantheses are > fine. Escape the forward slash with the backslash escape character, just > as you escape the comma. For example: > > CN=Doe\, Jane (LIFE U\/W),CN=Users,DC=Name1,DC=ad,DC=Name2,DC=com > > If you are retrieving the DN from some IADs method, all characters that > need to be escaped, will be escaped, except for the forward slash. In my > programs I use code similar to: > > strUserDN = Replace(strUserDN, "/", "\/") > > -- > Richard Mueller > MVP Directory Services > Hilltop Lab - http://www.rlmueller.net > -- > For Each strUser on objGroup.Member Set objMember = GetObject("LDAP://" & strUser) Wscript.Echo objMember.CN & ", " & objMember.Class Next with this: For Each strUser on objGroup.Member Set objMember = GetObject("LDAP://" & Replace(strUser, "/", "\/")) Wscript.Echo objMember.CN & ", " & objMember.Class Next Interestingly, you can use the Members method to retrieve a collect of object references to the members of the group. This method works even when the DN of a member has the "/" character. For example: For Each objMember In objGroup.Members Wscript. objMember.cn & ", " & objMember.Class Next I would actually prefer this method. The Members method of IADsGroup interface is able to bind to the member objects, I assume because it does not use ADSI (or perhaps someone coded the method to handle this situation). On Feb 24, 11:12 am, "Richard Mueller [MVP]" <rlmueller-
nos...@ameritech.nospam.net> wrote: Show quoteHide quote > "Richard Mueller [MVP]" <rlmueller-nos...@ameritech.nospam.net> wrote in Damn you're good! Your replace command to escape the forward slash> messagenews:uMLJLFqlJHA.3***@TK2MSFTNGP03.phx.gbl... > > > > > > > > > "Highlander" <tron9***@msn.com> wrote in message > >news:043c069b-cc9c-45df-b7bd-f1fb2ef91626@z1g2000yqn.googlegroups.com... > >> (watch for word wrap below) > > >> Hello all. > > >> I'm using the script found here: > >>http://www.microsoft.com/technet/scriptcenter/resources/qanda/apr05/h.... > > >> When I run it, as it cycles through all the members of the Group, if > >> the "strUser" variable is something like this: > >> CN=Smith\, John,CN=Users,DC=Name1,DC=ad,DC=Name2,DC=com > > >> ...there's no problem. > > >> But when the "strUser" variable is this: > >> CN=Doe\, Jane (LIFE U/W),CN=Users,DC=Name1,DC=ad,DC=Name2,DC=com > > >> Then the script blows up, on this line: > >> Set objMember = GetObject("LDAP://" & strUser) > > >> With this error message: > >> (null): 0x80005000 > > >> The obvious difference is that the strUser variable in question > >> contains parentheses. Anyone know a fix for this? > > >> Any help would be greatly appreciated. Thanks! > > >> - Dave > > > I believe the problem is actually the forward slash. AD does not require > > that this be escaped, but ADSI does. Both open and close parantheses are > > fine. Escape the forward slash with the backslash escape character, just > > as you escape the comma. For example: > > > CN=Doe\, Jane (LIFE U\/W),CN=Users,DC=Name1,DC=ad,DC=Name2,DC=com > > > If you are retrieving the DN from some IADs method, all characters that > > need to be escaped, will be escaped, except for the forward slash. In my > > programs I use code similar to: > > > strUserDN = Replace(strUserDN, "/", "\/") > > > -- > > Richard Mueller > > MVP Directory Services > > Hilltop Lab -http://www.rlmueller.net > > -- > > From the link you provided, replace this: > > For Each strUser on objGroup.Member > Set objMember = GetObject("LDAP://" & strUser) > Wscript.Echo objMember.CN & ", " & objMember.Class > Next > > with this: > > For Each strUser on objGroup.Member > Set objMember = GetObject("LDAP://" & Replace(strUser, "/", "\/")) > Wscript.Echo objMember.CN & ", " & objMember.Class > Next > > Interestingly, you can use the Members method to retrieve a collect of > object references to the members of the group. This method works even when > the DN of a member has the "/" character. For example: > > For Each objMember In objGroup.Members > Wscript. objMember.cn & ", " & objMember.Class > Next > > I would actually prefer this method. The Members method of IADsGroup > interface is able to bind to the member objects, I assume because it does > not use ADSI (or perhaps someone coded the method to handle this situation). > > -- > Richard Mueller > MVP Directory Services > Hilltop Lab -http://www.rlmueller.net > --- Hide quoted text - > > - Show quoted text - worked like a champ. For that, and for the additional info, thanks Richard! Happy Fat Tuesday! - Dave
Show quote
Hide quote
"Highlander" <tron9***@msn.com> wrote in message
news:043c069b-cc9c-45df-b7bd-f1fb2ef91626@z1g2000yqn.googlegroups.com... > (watch for word wrap below) > > Hello all. > > I'm using the script found here: > http://www.microsoft.com/technet/scriptcenter/resources/qanda/apr05/hey0419.mspx > > When I run it, as it cycles through all the members of the Group, if > the "strUser" variable is something like this: > CN=Smith\, John,CN=Users,DC=Name1,DC=ad,DC=Name2,DC=com > > ...there's no problem. > > But when the "strUser" variable is this: > CN=Doe\, Jane (LIFE U/W),CN=Users,DC=Name1,DC=ad,DC=Name2,DC=com > > Then the script blows up, on this line: > Set objMember = GetObject("LDAP://" & strUser) > > With this error message: > (null): 0x80005000 > > The obvious difference is that the strUser variable in question > contains parentheses. Anyone know a fix for this? > > Any help would be greatly appreciated. Thanks! > > - Dave
modify incremental_backup
Script to set share permissions on home directories Drop leading zeros in a variable Deleting and re-installing printer with new name using login scrip Echo to column position Script to set user permissions Undefined variable in login script Script to find the presence of a software Scruot to check user rights on folders/subfolders startup scripting |
|||||||||||||||||||||||