{"id":116,"date":"2009-02-04T13:18:11","date_gmt":"2009-02-04T13:18:11","guid":{"rendered":"http:\/\/www.edwardsd.co.uk\/work\/?p=116"},"modified":"2016-02-18T00:22:35","modified_gmt":"2016-02-18T00:22:35","slug":"report-of-all-users-and-groups-in-my-ad","status":"publish","type":"post","link":"https:\/\/www.edwardsd.co.uk\/work\/2009\/02\/report-of-all-users-and-groups-in-my-ad\/","title":{"rendered":"Report of all Users and Groups in my AD (DomainUinfo.vbs)"},"content":{"rendered":"<p>I usually get asked a lot for lists, specifically lists of AD users and members of groups etc. There are a couple of methods to obtain this&#8230;<\/p>\n<p><strong>Output user list in txt format using CMD: <\/strong><\/p>\n<ul>\n<li>net user \/domain &gt; C:users.txt (Only Lists Logon Usernames \/ no OU or Group Info)<\/li>\n<\/ul>\n<hr \/>\n<p><strong>Output user list in .txt format (more detail) using VBS: <\/strong><\/p>\n<ul>\n<li>Simple VBS Script to printout the AD information<\/li>\n<li>Text file output to the same folder the script was run from&#8230;<\/li>\n<li>I&#8217;ve slightly tweaked this script to make the output data more easy on the eyes.<\/li>\n<\/ul>\n<p><!--more--><\/p>\n<pre lang=\"basic\">'********************************************************************\n'*\n'* File: DomainUinfo.vbs\n'* Created: September 2005\n'* Version: 2k510.04\n'*\n'* ' Sample Script For Listing All The User Related Infomations In The Domain.\n'*\n'* Main Function: Listing All The User Related Infomations In The Domain.\n'*\n'* Syntax Domain Name\n'*\n'* Copyright (C) 2005 N Nattiala\n'*\n'********************************************************************\n' Description - This portion of the script will attach to the domain using the\n' WinNt provider and filter out a list of every computer object's\n' name and write them to DomUinfo.txt. If the file already exists it will\n' overwrite, otherwise it will create the file.\n'-------------------------------------------------\n' Insert WARNING here...\nMsgbox \" This script will collect all the Computers,Domain User and Group related information and\"_\n&amp; vbcrlf &amp; vbcrlf &amp; \" store in DOMUINFO.TXT. Please input your Domain name according to your environment\" _\n&amp; vbcrlf &amp; vbcrlf &amp; \" Created and Completed By: N Nattiala. \",48,\"WARNING\"\n\n' Check for the existence of DomUinfo.txt.\n' and open for Writing.\n\nDim myComputer, objUser, objGroup\nDim myDomain\nSet fsoObject = WScript.CreateObject(\"Scripting.FileSystemObject\")\nIf (fsoObject.FileExists(\"DomUinfo.txt\")) Then\nSet open_File = fsoObject.OpenTextFile(\"DomUinfo.txt\", 2)\nElse\nSet open_File = fsoObject.OpenTextFile(\"DomUinfo.txt\", 2, \"True\")\nEnd If\n\n' Get Domain Name\nmyDomain = Inputbox (\"Please Enter Your Domain Name: \"_\n&amp; vbcrlf &amp; vbcrlf &amp; \" Take Care\")\n\n'msgbox\" Your Domain Name is :\" &amp;mydomain _\n'&amp; vbcrlf &amp; vbcrlf &amp;\"Do you wish to cancel this Script?\",vbYesNo,\"Warning\"\n\n' Attach to the domain and search for all\n' computer objects. Dump the names into\n' DomUinfo.txt.\n\nSet myComputer = GetObject ( \"WinNT:\/\/\"&amp; mydomain )\nmyComputer.Filter = Array(\"computer\")\nFor Each item in myComputer\nopen_File.Writeline (item.Name)\nNext\nmyComputer.Filter = Array(\"user\")\nFor Each objuser in myComputer\nopen_File.Writeline (\"User Name: \" &amp; objUser.Name &amp; \" - Full Name: \" &amp; objuser.fullname &amp; \" - Description: \" &amp; objuser.description)\nNext\nmyComputer.Filter = Array(\"group\")\nFor Each objGroup In myComputer\nFor Each objUser In objGroup.Members\nopen_File.Writeline (\"Group: \" &amp; objGroup.Name &amp; \" - Username: \" &amp; objUser.Name)\nNext\nNext\n' Closes the file\nopen_File.Close()<\/pre>\n<div><\/div>\n","protected":false},"excerpt":{"rendered":"<p>I usually get asked a lot for lists, specifically lists of AD users and members of groups etc. There are a couple of methods to obtain this&#8230; Output user list in txt format using CMD: net user \/domain &gt; C:users.txt (Only Lists Logon Usernames \/ no OU or Group Info) Output user list in .txt [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[8,18,23],"tags":[],"class_list":["post-116","post","type-post","status-publish","format-standard","hentry","category-vbs","category-windows-server-2003","category-windows-server-2008"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pOPt8-1S","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.edwardsd.co.uk\/work\/wp-json\/wp\/v2\/posts\/116","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.edwardsd.co.uk\/work\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.edwardsd.co.uk\/work\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.edwardsd.co.uk\/work\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.edwardsd.co.uk\/work\/wp-json\/wp\/v2\/comments?post=116"}],"version-history":[{"count":1,"href":"https:\/\/www.edwardsd.co.uk\/work\/wp-json\/wp\/v2\/posts\/116\/revisions"}],"predecessor-version":[{"id":3071,"href":"https:\/\/www.edwardsd.co.uk\/work\/wp-json\/wp\/v2\/posts\/116\/revisions\/3071"}],"wp:attachment":[{"href":"https:\/\/www.edwardsd.co.uk\/work\/wp-json\/wp\/v2\/media?parent=116"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.edwardsd.co.uk\/work\/wp-json\/wp\/v2\/categories?post=116"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.edwardsd.co.uk\/work\/wp-json\/wp\/v2\/tags?post=116"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}