{"id":162,"date":"2008-09-02T10:47:11","date_gmt":"2008-09-02T10:47:11","guid":{"rendered":"https:\/\/www.wapshere.com\/missmiis\/?page_id=162"},"modified":"2008-09-02T11:39:29","modified_gmt":"2008-09-02T11:39:29","slug":"check-group-member-dns-exist-in-ad","status":"publish","type":"page","link":"https:\/\/www.wapshere.com\/missmiis\/check-group-member-dns-exist-in-ad","title":{"rendered":"dn-missing.vbs Check group member DNs exist in AD"},"content":{"rendered":"<pre>' Export a group from the connector space.\r\n' Try to bind to each member in AD to confirm they exist.\r\n' Use for troubleshooting dn-attributes-failure and cd-missing-object errors.\r\n'\r\n' Written by Carol Wapshere, 2008, www.wapshere.com\r\n'\r\nOption Explicit<\/pre>\n<pre>Const MA_NAME = \"AD_Groups\"\r\nConst CSEXPORT = \"C:\\Program Files\\Microsoft Identity Integration Server\\Bin\\csexport.exe\"\r\nConst DC = dc.mydomain.com\r\nConst ForReading = 1\r\nConst ForWriting = 2\r\nConst ForAppending = 8\r\nConst UNICODE = -1<\/pre>\n<pre>Dim strGroupDN, strXMLFileName, strXML, strUserDN, strCmd\r\nDim objFS, objXMLFile, objShell, objUser, objExec\r\nDim iStart<\/pre>\n<pre>strXMLFileName = MA_NAME &amp; \".xml\"<\/pre>\n<pre>If WScript.Arguments.Count &lt;&gt; 1 Then\r\n\u00c2\u00a0 Usage\r\nEnd If\r\nstrGroupDN = WScript.Arguments.Item(0)<\/pre>\n<pre>wscript.echo \"\"<\/pre>\n<pre>Set objFS = CreateObject(\"Scripting.FileSystemObject\")\r\nIf objFS.FileExists(strXMLFileName) Then objFS.DeleteFile(strXMLFileName)<\/pre>\n<pre>strCmd = CSEXPORT &amp; \" \" &amp; MA_NAME &amp; \" \/f:d=\" &amp; chr(34) &amp; strGroupDN &amp; chr(34)\r\nwscript.echo strcmd<\/pre>\n<pre>Set objShell = CreateObject(\"WScript.Shell\")\r\nSet objExec = objShell.Exec(strCmd)<\/pre>\n<pre>wscript.echo \"\"\r\nwscript.echo \"Exporting connector space object\"\r\nwscript.sleep 1000\r\nSet objXMLFile = objFS.GetFile(strXMLFileName)\r\nDo While objXMLFile.Size = 0\r\n\u00c2\u00a0wscript.echo \".\"\r\n\u00c2\u00a0wscript.sleep 1000\r\nLoop<\/pre>\n<pre>Set objXMLFile = objFS.OpenTextFile(strXMLFileName,ForReading,False,UNICODE)<\/pre>\n<pre>strXML = objXMLFile.ReadAll<\/pre>\n<pre>Do While InStr(strXML, \"&lt;dn&gt;\") &gt; 0\r\n\u00c2\u00a0 iStart = InStr(strXML, \"&lt;dn&gt;\") + Len(\"&lt;dn&gt;\")\r\n\u00c2\u00a0 strXML = Mid(strXML, iStart)\r\n\u00c2\u00a0 strUserDN = Left(strXML, InStr(strXML, \"&lt;\/dn&gt;\") - 1)\r\n\u00c2\u00a0 'wscript.echo strUserDN\r\n\u00c2\u00a0\r\n\u00c2\u00a0 'Try to bind to the User DN\r\n\u00c2\u00a0 Set objUser = Nothing\r\n\u00c2\u00a0 On Error Resume Next\r\n\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 Set objUser = GetObject(\"LDAP:\/\/\" &amp; DC &amp; \"\/\" &amp; strUserDN)\r\n\u00c2\u00a0 On Error Goto 0\r\n\u00c2\u00a0 If objUser is Nothing Then\r\n\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 wscript.echo \"User not found: \" &amp; strUserDN\r\n\u00c2\u00a0 End If\r\nLoop<\/pre>\n<pre>\u00c2\u00a0<\/pre>\n<pre>Sub Usage\r\n\u00c2\u00a0 wscript.echo \"Check groups members from the connector space of MA AD_Groups\"\r\n\u00c2\u00a0 wscript.echo \"to confirm they exist in AD.\"\r\n\u00c2\u00a0 wscript.echo \"\"\r\n\u00c2\u00a0 Wscript.echo \"Usage: cscript dn-missing.vbs groupDN\"\r\n\u00c2\u00a0 wscript.echo \"\"\r\n\u00c2\u00a0 Wscript.Quit\r\nEnd Sub<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>&#8216; Export a group from the connector space. &#8216; Try to bind to each member in AD to confirm they exist. &#8216; Use for troubleshooting dn-attributes-failure and cd-missing-object errors. &#8216; &#8216; Written by Carol Wapshere, 2008, www.wapshere.com &#8216; Option Explicit Const MA_NAME = &#8220;AD_Groups&#8221; Const CSEXPORT = &#8220;C:\\Program Files\\Microsoft Identity Integration Server\\Bin\\csexport.exe&#8221; Const DC =&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"jetpack_post_was_ever_published":false,"footnotes":""},"class_list":["post-162","page","type-page","status-publish","hentry"],"jetpack_shortlink":"https:\/\/wp.me\/Pkp1o-2C","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/pages\/162","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/comments?post=162"}],"version-history":[{"count":4,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/pages\/162\/revisions"}],"predecessor-version":[{"id":164,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/pages\/162\/revisions\/164"}],"wp:attachment":[{"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/media?parent=162"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}