Posts Tagged Active Directory

DSQuery Operating System Service Pack Version

I had a requirement recently to get the service pack versions for all workstations on the domain. I tried a few different options but the easiest option was to use the extremely useful dsquery tool.

Without further ado, this is the command:
dsquery * -scope subtree -attr "cn" "operatingSystem" "operatingSystemServicePack"  -filter "(&(objectclass=computer)(objectcategory=computer)(operatingSystem=Windows XP*))" -limit 100000
The output of this command would be as follows:

cn                 operatingSystem                      operatingSystemServicePack
WRK001    Windows XP Professional     Service Pack 1
WRK002    Windows XP Professional     Service Pack 2
WRK003    Windows XP Professional     Service Pack 3

Where, cn is the workstation name and the others are self explanatory.

Share your handy little tips and tricks!

, , , , , ,

5 Comments

How to Backup and Restore Active Directory

There are many documents written about backing up Active Directory but I didn’t find enough documentation that would help us restore Active Directory. So here is a guide aimed to provide insights into correctly backing up and restoring Active Directory.

Here is my mini how to – I have tried to keep it as simple as possible:

Read the rest of this entry »

, ,

1 Comment

Active Directory Password Expiry Reminder Email

If you have managed an Active Directory installation that has a large number of users who connect to the network infrequently, you may have faced a problem where the user’s password expires when they are away from the network and possibly leaving them in a situation where they are not able to reset their password remotely.

I recently was in this situation and had to write a script to intimate users about an impending password expiry. Here is what the script does:

Read the rest of this entry »

, , ,

19 Comments

Get list of machines by OS type from Active Directory

Here is an easy way of getting a list of computers that have a particular OS type from Active Directory using DSQuery.

dsquery * domainroot -filter "(&(objectCategory=computer)(operatingSystem=Windows XP*))"

The command above would give you a list of all computers that have a Windows XP operating system. For Windows Servers, change the command as follows:

dsquery * domainroot -filter "(&(objectCategory=computer)(operatingSystem=Windows Server*))"

The output of the commands above would look something like this:

samid
server1$
server2$
server3$
dsget succeeded

Note the ‘samid’ at the head and ‘dsget succeeded’ at the end and the ‘$’ at the end tail of every server name. If you are like me, and you would like just get a nice clean output with only server names, you can run this command:

Read the rest of this entry »

, , ,

1 Comment

Active Directory Audit Script

Paul Bergson wrote this brilliant script that queries active directory and gives you a wealth of information that can be used to audit active directory.

I have slightly modified this script and added a few lines to get information like the email address and the exchange home server of the user using the mail and msExchHomeServerName attributes.

You can download the modified script here.

How the script works:

Read the rest of this entry »

, , ,

1 Comment