Export information from Active Directory to a CSV file

I wanted to reboot all PC’s in a particular OU of our Active Directory structure.  I found csvde which is a tool for exporting and importing data to and from Active Directory.
Once I got all of the computer names out and into a csv file I used the shutdown -i tool to past the computer names into and let it remotely reboot them.

Here are some sample csvde scripts for exporting various pieces of information:

Export everything (computers, users, groups etc.  This could be a lot of records depending on your Active Directory so be careful.):

CSVDE -f exportFilename.csv

Export computer accounts from specified OU with only a few columns (just does dn, cn and name columns):

csvde -f ComputerNamesExport.csv -d “OU=OUName,DC=domain,DC=org” -r “(objectClass=computer)” -l “dn,cn,name”

– You can leave off the -l “dn,cn,name” and you’ll get all columns.

Export user accounts from whole domain with only the specified columns:

csvde -f \\server1\common\it\UserNamesExport.csv -d “DC=CBCO,DC=org” -r “(objectCategory=person)” -l “dn,cn,displayName,description,title,department,physicalDeliveryOfficeName,company”

– You can leave off -l and the rest to get all columns.

“The Datasheet view is attempting to retrieve data from a different domain” error in Microsoft Windows Server Sharepoint Services 3.0

ms-office-logo

I kept getting this error message that stated “”The datasheet view is attempting to retrieve data from a different domain…contact your system administrator to resolve this issue.”

Well, I am the system administrator and I had no idea how to resolve this issue!  After a bit of searching on the web I found someone who mentioned load balancing and alternate access mappings.
I’m not doing any load balancing so I looked further into alternate access mappings and found instructions on changing these mappings.
You have to enter the Sharepoint Administration console.  When you install Sharepoint it’s setup on a random port on your server.  In my instance it was http://intranet.domain.com:14212
You can open IIS and right click on the Sharpoint Central Administration site and select bindings it’ll tell you which port it’s setup on.

Once you are get to the Sharepoint Administration, click on operations on the left side then Alternate access mappings on the right side.
So by default I had http://intranet  (this will likely be the name of your server).
I then added an internal url (there’s a button along the menu bar for this) with http://intranet.domain.com

After doing this I no longer get the datasheet view error and am able to edit and save the changes.

Note:  I am using Windows Sharepoint Services 3.0 and not the Sharepoint Server 2007.  I don’t know if there’s a difference in the setup or if this error even occurs on that version.

Redirect new computer accounts in Windows Server 2003 domain to a different location

2003server.jpg
While studying for the MCSE 70-294 test on active directory I ran across this little command that I was previously not aware of. redircmp.exe

So, you can type:  redircmp ou=mycomputers,DC=corp,dc=com

Replace the mycomputers with the ou (organizational unit) that you want all new computer accounts to go to.  Replace the corp with your domain name and the com with

Pretty cool!  I made a new OU where I store my computer accounts in and I always forget that new computer accounts go to the computers ou and it generally takes me a minute or two before I remember.  This way new computer accounts will automatically go to the ou of my choice.

Go here to Microsoft’s website for more info on these commands.

You can also use: redirusr ou=myusers,DC=corp,dc=com

This will redirect the location that new user accounts are made in.  I don’t use this one, but it is good to know.