PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Hébergement serveur > ms.win.server.scripting > computer accounts in AD
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
computer accounts in AD

Réponse
 
LinkBack Outils de la discussion
Vieux 02/10/2007, 23h20   #1
rt
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut computer accounts in AD

Newbie here,
I'm looking for a way to list all computers in a specific OU and the dump
the output to an excel file. Can someone me with this.

thanks,

rt
  Réponse avec citation
Vieux 03/10/2007, 00h29   #2
Richard Mueller [MVP]
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: computer accounts in AD

rt wrote:

> Newbie here,
> I'm looking for a way to list all computers in a specific OU and the dump
> the output to an excel file. Can someone me with this.


A simple VBScript program can bind to the OU, filter on computer objects,
then output NetBIOS names (or the values of whatever attributes you want),
one computer per line. If you output more than one attribute per computer,
delimit them with a character that will not be in any attribute values. Such
a file can be easily read into a spreadsheet. For example:
============
' Bind to OU, specified by Distinguished Name.
Set objOU = GetObject("LDAP://ou=Sample,ou=West,dc=MyDomain,dc=com")

' Filter on computer objects.
objOU.Filter = Array("computer")

' Enumerate all computers in the OU.
For Each objComputer In objOU
Wscript.Echo objComputer.cn
Next
===========
If this VBScript is saved in the file EnumComputers.vbs, run it at a command
prompt with cscript and redirect the output to a text file:

cscript //nologo EnumComputers.vbs > computers.csv

I used the cn (Common Name) attribute above. You can use
objComputer.sAMAccountName, which is the NetBIOS name of the computer with
"$" appended on the end. Or you can use objComputer.distinguishedName. If
you want the script to create and write values to a Microsoft Excel
spreadsheet, you can use the following example as a template:

http://www.rlmueller.net/Write%20to%20Excel.htm

Also, you can use Joe Richards' free adfind utility. It can retrieve objects
matching a filter in a base OU and output to a csv file.

http://www.joeware.net/win/free/tools/adfind.htm

I think some other command line tools could be used as well, but adfind is
the best.
--
Richard Mueller
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net
--


  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 01h58.


Édité par : vBulletin® version 3.7.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,09135 seconds with 10 queries