Active Directory Users and Computers in Windows 7

Windows 7 is officially my favorite OS yet!

Here’s how to get the Active Directory Users and Computers installed on Windows 7.  It’s not quite as clear cut as with XP.

First you need to download the Remote Server Administration Tools (that’s the new name for what used to be Server 2003 Admin Pak).

It’s available here from Microsoft.

After you install it you won’t find it anywhere except for a help file in the Adminstrative tools labeled “Remote Server Administration Tools”  This help file was not very helpful.

The key to the puzzle is to go to the control panel and click on programs.
Then click on Turn Windows Features on or off.
In the list of features you’ll find the “Remote Server Administration Tools” section.
Click on the plus next to “Role Administration Tools”.
From there you can enable the Active Directory tools.  After you hit ok you’ll now have Active directory users and computers under the administrative tools.

windows features

Exchange 2007 Powershell fun

We needed to setup about a hundred new users in our Exchange 2007 environment.  Rather than create each user individually I researched how to import the users from a CSV file.  To do this you need to download and install Quest Software’s free active directory powershell commands.
Here is the script I finally ended up with:

$OuBorn = ‘OU=OrganizationalUnit,DC=MyDomain,DC=com’
$Freshmen = ‘C:\ImportUsers.csv’
import-csv $Freshmen |`
where {new-QADUser -ParentContainer $OuBorn `
-name $ -sAMAccountName $_.sAMAccountName `
-City $ -Company $_.Company -Department $_.Department `
-FirstName $_.FirstName -LastName $_.LastName `
-StreetAddress $_.StreetAddress -State $_.State `
-Title $_.Title -userPrincipalName $_.userPrincipalName `
-userPassword $_.userPassword -DisplayName $ `
-Office $_.Office ; enable-QADUser $ `

The first 2 lines setup where you are creating the new users and the path to the file you are creating them from. Line 3 through the end is the main work.  This will create users populated from a CSV file and fills in the First and Last name, City, Company, Department, Street Address, User Principal Name, Password, Display Name and their Office.  Finally it also enables the user account.  (Note:  take notice of the ` at the end of each line in the main script.  This allows you to write the script in a text editor and use multiple lines which helps with readability)

I created the users into a new OU so I could keep track of the users and make it easier to work with just those accounts.  You could get fancy and add to the script to make the mailboxes and such but I just decided to make the users and then use the Exchange GUI to make the mailboxes since you can pick a whole OU of users and generate mailboxes from there.

One problem I ran into was I tried to give all of the user accounts a generic password and then set the “User must change password on next logon” flag.  This worked but these users will only be logging onto the network using Outlook Web Access.  Exchange 2007’s Outlook Web Access get’s stuck and won’t let the user logon to change the password unless you first logon to the account then set the “User must change password on next logon” setting.  Since I didn’t want to have to log onto 90 something user accounts I just generated their password for them and it’ll prompt them to change the password in 6 months.

Here is a sample CSV file that I used for testing.

Also I wanted to restrict these new users from receiving email from outside the organization to cut down on potential spam.  I did this by using the following powershell:

Get-Mailbox -OrganizationalUnit “NewUsers” | Set-Mailbox -AcceptMessagesOnlyFromDLMembers “All Company Email”

So we have a dynamic distribution list called “All Company Email” that has everyone in the organization in it.  This script restricts everyone in the NewUsers OU (by using the Get-Mailbox command) to only be able to receive email from those in the “All Company Email” distribution list. check for existence of files and or folders

Add this to check the existence of a particular file:
Dim sFileName As String
sFileName = “C:/text1.txt”
Dim fFile As New FileInfo(sFileName)
If Not fFile.Exists Then
MessageBox.Show(“File Not Found”)
MessageBox.Show(“File Found. File was created on: ” & fFile.CreationTime)
End If

Add this to check the existence of a directory:
Dim sDirName As String
sDirName = “C:/temp”
Dim dDir As New DirectoryInfo(sDirName)
If Not dDir.Exists Then
MessageBox.Show(“Directory Not Found”)
MessageBox.Show(“Directory Found. Directory was last accessed on: ” & dDir.LastAccessTime)
End If

Exchange 2007 Spam filter Whitelisting

We’ve recently upgraded our Exchange 2003 server to Exchange 2007.  There’s a lot of new and updated features in this version.  The Anti-Spam features seem to be working very good but are catching some legitimate emails.  I found the following shell commands for adding email addresses or whole domains to the white lists to keep them from getting blocked. 
If you are like I was and didn’t have a clue what shell commands meant, open the Exchange Management Shell from the start menu.  It’s a command prompt for doing various command line based tasks.  You can perform pretty much everything you can normally do from the gui interface from a command line.  This makes creating scripts to perform repetative tasks a snap.

  • Whitelist a domain:
       Set-ContentFilterConfig -BypassedSenderDomains,
  • Whitelist an address:
       Set-ContentFilterConfig -BypassedSenders,
  • Copy the config of the content filter to the clipboard for viewing in a text editor:
        get-contentfilterconfig | clip 
  • I found these commands here.

    Play DVDs Fedora 10

    su –

    yum install libdvdread libdvdnav lsdvd

    You will only be able to play un-encrypted DVDs with the above installs.  You have to get libdvdcss which has legal issues in the US.

    rpm -Uvh
    yum install libdvdcss

    Remote desktop connection in Linux

    I installed a fresh copy of Fedora 10 (which I’m thinking is my favorite Linux distro so far) on my laptop and have been seeing what all I can and can’t do that I normally do on a regular basis.  Right away I wanted to use Remote Desktop to connect to my Windows Server 2008 box.  Well, I coulnd’t find a Remote Desktop client.  I jumped on Google and found mention of RDesktop.  I managed to get that installed and it worked, but I had to launch a terminal prompt and type rdesktop [ServerName].

    I poked around some more and found mention of TSClient.  I had gone to the Add/Remove Software tool and searched for remote desktop and rdp and a number of other things, but hadn’t thought to search for TSClient.  It makes sense now that I think about it since remote desktop is also called Terminal Services.

    Anyways, to get a GUI based Remote Desktop client search for TSClient and install that.  As a bonus it also installs a VNC viewer as well, which is another tool I use.

    Show all files in Mac OS X

    In my quest to learn more operating systems and just show more of my geekiness I’ve been playing with installing OS X on a regular PC and on my laptop.  Clearly they made OS X to work with a small subset of hardware and had no intention on letting anyone experience the Mac OS outside of their hardware.

    One of the first annoyances was that Apple hides all system files and doesn’t have an easy way to turn them back on.  Here is a command to make all files visible in the Finder application:

    (From the terminal)
    defaults write AppleShowAllFiles TRUE

    (This next command kills all instances of Finder to make the change effective)
    killall Finder

    Re-open Finder and you’ll be able to see all system files now.

    Linux commands – mounting Windows shares and configuring sound

    Command to mount a Windows share to a folder in Linux:

    mount -t cifs //[ServerName]/[SharedFolder] /[MountFolder] -o username=[ServerName]/[Username],password=[Password]

    For the mount folder I created a folder under /home/[MyUsername] using MKDir /home/[MyUsername]/Videos

    Remove the brackets from Servername etc.  Also make sure there’s no spaces between the = and the username or password.

    Troubleshooting Audio problems:

    Open Suse has a great audio troubleshooting page found here.