Posts Tagged Windows Scripts
Remotely Enable Remote Desktop
A lot of articles on the web point to how this can be done the hard way.
This is how you can do it with a single command: Read the rest of this entry »
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:
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:
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:

Recent Comments