|
server
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Re: List all servers in a domain
import to excel, just do the following at the command prompt: Cscript SCRIPTFILENAME.vbs >OUTPUT.txt This redirects the output to the listed text file. Have a great day! Paul. Show quote "Richard Mueller [MVP]" wrote: > > "Twat-in-the-Hat" <Twatinthe***@discussions.microsoft.com> wrote in message > news:A757843D-6F8E-4883-A9CF-B3DD9E313054@microsoft.com... > > Hi please help. > > > > I have been trying to create a script to list all servers in my domain and > > output to a excel file. so far i have managed only to output all machine > > names to screen in the domain. Does somebody have a working example or can > > point me in the right direction. Any help would be appreciated as im very > > new > > to this. > > > > A VBScript program to enumerate all servers: > > http://www.rlmueller.net/Enumerate%20Servers.htm > > The program finds all computer objects in AD with "server" in the > operatingSystem attribute. Another method would enumerate all objects in the > "cn=Servers" containers of all sites in "cn=Sites" of the configuration > container. For example: > ============ > Set objRootDSE = GetObject("LDAP://RootDSE") > strConfig = objRootDSE.Get("configurationNamingContext") > > Set objSiteContainer = GetObject("LDAP://cn=Sites," & strConfig) > objSitesContainer.Filter = Array("site") > > For Each objSite In objSitesContainer > ' Wscript.Echo "Site: " & objSite.cn > Set colServers = GetObject("LDAP://cn=Servers," & objSite.Name _ > & ",cn=Sites," & strConfig) > For Each objServer In colServers > ' Wscript.Echo "-- Server: " & objServer.cn > Wscript.Echo objServer.cn > Next > Next > =========== > In both cases, the output can be redirected to a text file, which can be > imported into a spreadsheet. If you need an example for how to write output > to an Excel spreadsheet, see this link: > > http://www.rlmueller.net/Write%20to%20Excel.htm > > -- > Richard Mueller > Microsoft MVP Scripting and ADSI > Hilltop Lab - http://www.rlmueller.net > -- > > > |
|||||||||||||||||||||||