?
Solved

configure dsquery output to display only computer name

Posted on 2014-10-06
4
Medium Priority
?
2,206 Views
Last Modified: 2014-10-06
Hey Experts.  I am outputting all computer accounts that are inactive in my environment using DSQUERY.  Here is the command I'm using currently.

C:\Tools>dsquery computer -limit 0 ou=depts,ou=12,dc=34,dc=56,dc=78,dc=90 >>c:\tools\computers_all.log

The results show way too much information and I want to filter out everything except the hostname.  Anyone know the syntax for this?

Thanks experts!
0
Comment
Question by:samiam41
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 13

Accepted Solution

by:
Gabriel Clifton earned 2000 total points
ID: 40363758
dsquery computer -o rdn -limit 0 ou=depts,ou=12,dc=34,dc=56,dc=78,dc=90 >>c:\tools\computers_all.log
0
 
LVL 9

Author Comment

by:samiam41
ID: 40363763
Thank you!!  Glad that's been solved!
0
 
LVL 13

Expert Comment

by:Gabriel Clifton
ID: 40363772
No problem, I do that command all the time.
0
 
LVL 28

Expert Comment

by:Dan McFadden
ID: 40363778
Are you open to using Powershell?  It would be much easier.

Get-ADComputer -Property Name, lastLogonDate -filter * | where lastLogonDate -lt (Get-Date).AddDays(-500) | select Name,lastLogonDate,DistinguishedName,Enabled | Export-Csv test.csv -noTypeInformation -UseCulture

Open in new window


*** Note:  to adjust the age of the the inactivity,  adjust the number in here:  (Get-Date).AddDays(-500)
*** this indicates inactivity over 500 day.  for computers that haven't been active for 90 or more days, use 90.

This will give you a CSV file that you can use in Excel.


Dan
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Had a business requirement to store the mobile number in an environmental variable. This is just a quick article on how this was done.
Group policies can be applied selectively to specific devices with the help of groups. Utilising this, it is possible to phase-in group policies, over a period of time, by randomly adding non-members user or computers at a set interval, to a group f…
This Micro Tutorial will give you a basic overview of Windows Live Photo Gallery and show you various editing filters and touches to photos you can apply. This will be demonstrated using Windows Live Photo Gallery on Windows 7 operating system.
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…
Suggested Courses

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question