I’m trying out a new Live Write plugin for Amazon. Here is a list of books I have currently authored or co-authored. This list will continue to grow as I’m working on a new book now about managing Active Directory with PowerShell.
I hope you’ll check them out.
A few of my recent Mr. Roboto columns have been about group auditing. I first published an HTA that would report on group membership last December. Astute reader Matt V. found a bug with the way nested group memberships were being reported. Or in this case, not being reported. It turns out that if a group was a member of one other group, that membership was not reported. But if the group was nested in 2 or more groups then you’d see all the nested groups. After a little debugging I found my goof. I used ADSI to get a reference to the specified group:
<span class="kwrd">Set</span> objGroup=GetObject(<span class="str">"LDAP://"</span> & strDN)
strDN would have a value like CN=Sales,OU=Groups,DC=Mycompany,DC=local. My mistake was in assuming that the MemberOf property would always be a collection so I was using a ForEach construct. But it is only a collection if there is more than one group. So I modified the code:
<span class="kwrd">If</span> IsArray(objGroup.MemberOf) <span class="kwrd">Then</span><br /> Trace <span class="str">"MemberOf is a collection"</span><br /> <span class="kwrd">For</span> <span class="kwrd">Each</span> member <span class="kwrd">In</span> objGroup.MemberOf<br /> Trace <span class="str">"found member of "</span> & member<br /> strMemberOf=strMemberof & <span class="str">" "</span> & member & VbCrLf<br /> <span class="kwrd">Next</span><br /><span class="kwrd">Else</span><br /> Trace <span class="str">"found member of "</span> & objGroup.MemberOf<br /> strMemberOf=strMemberof & <span class="str">" "</span> & objGroup.MemberOf & vbcrlf<br /><span class="kwrd">End</span> If
Because I used the same code in a followup article where I released a command line version of the tool, I had to modify that tool as well. The above code snippet is actually from the WSF version.
Anyway, both versions have now been updated and are available for download from the Mr. Roboto section of my script library. Thank you Matt for keeping me on my toes.
Technorati Tags: Mr Roboto
, ADSI, HTA
I will be doing a live 2 day VBScript class this fall in Las Vegas (Oct. 22 and 23). I’ll be covering ADSI, WMI, HTAs, WSF and more. This is a class for experienced VBScripters who want to take it to the next level. This is a hands on class with with labs and one on one attention.
This class is actually part of a week long training session. The rest of the week is PowerShell taught by PowerShell MVP (and my occasional co-author) Don Jones. You can take either my 2 day VBScript, Don’s 3 day PowerShell course or the full week. If you take the full week you also get invited to a gourmet dinner which I’m sure will be a one of Vegas’ fine restaurants.
You can learn more and register at http://www.scriptingtraining.com/ILT/schedule.asp.