get-adcomputer syntax assistance

I want to run the get-adcomputer report - as described here:

http://social.technet.microsoft.com/wiki/contents/articles/12056.active-directory-get-adcomputer-default-and-extended-properties.aspx 

Can anyone help me develop the command to syntax to list all properties/fields for all ad computers, and also write the report out to a CSV file. I am new to such cmdlets.
LVL 3
pma111Asked:
Who is Participating?
 
SubsunCommented:
If you need all properties then
Get-ADComputer -Filter * -Properties * | Export-csv  C:\report.csv -nti

Open in new window

Or you can slo select specific properties..
Get-ADComputer -Filter * -Properties * | Select Name,DNSHostName,IPv4Address  | Export-csv  C:\report.csv -nti

Open in new window

0
 
QlemoBatchelor, Developer and EE Topic AdvisorCommented:
This is not useful. Restrict yourself to interesting attributes! But if you need to:
Get-ADComputer -ResultSize unrestricted -Filter * -Properties * |
  export-csv -NoType C:\Temp\EE\ADComputer.Txt

Open in new window

0
 
pma111Author Commented:
Thanks both - is there any specific attribute that would give clues as to whether a specific wokrstation is being used? Can you provide any tips what field you would use to try and root out stale machines that have perhaps been recycled and not removed from AD..?
0
Creating Active Directory Users from a Text File

If your organization has a need to mass-create AD user accounts, watch this video to see how its done without the need for scripting or other unnecessary complexities.

 
pma111Author Commented:
If you dont add " -ResultSize unrestricted " to the command, does powershell stop at a specific number of results? if so what is that value? i.e. how many records will it return?
0
 
SubsunCommented:
There is no -ResultSize parameter for Get-ADComputer command, Get-ADComputer -Filter * should return all computer objects.

There is no property in AD computer object to tell you whether the computer is being used. You can use LastLogonDate, to find when the last time computer logged in to AD.

Another option to find inactive accounts is to use Search-ADAccount. For example, To find all computer accounts that have been inactive for the last 90 days
Search-ADAccount -ComputersOnly -AccountInactive -TimeSpan 90

Open in new window

0
 
Will SzymkowskiSenior Solution ArchitectCommented:
Thanks both - is there any specific attribute that would give clues as to whether a specific wokrstation is being used

You can use the attributes Enabled, LastLogonDate or LastLogonTimeStamp to get info on this machine and if it is actually being used.

If you dont add " -ResultSize unrestricted "

ResultSize is not part of this cmdlet for get-adcomputer. So it will return all of the computers that is finds in Active Directory.

Will.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.