ate by monsters

This little monster contains some of my thoughts. So please be careful as he tends to bite . . . he’s teething. I do apologize.

Categories
Monday
08Feb2010

PowerShell: Script to make batch DNS changes

Typically when you host websites that require 99.999% uptime you create a basic webfarm that sits behind an F5 BigIP ... not every company has a budget to do high availablity or DR correctly.  So I wasn't shocked when I was tasked to write a script to modify DNS CNAME records target host FQDN with a new FQDN.

Welcome to my situation :)  If we lose an IIS server we would have to move all the sites that box was hosting to another and then update the CNAME's target fully qualified domain name field.

Found a bunch of great stuff online on how to modify a single record ... that's great for updating maybe a handful, not if it's over 100+ records and I'm not about to do that manually via MMC console!  So I need to get a little creative and here's what I came up with.

$CNAMES = import-csv "Path to CSV file"
$Query = "Select * from MicrosoftDNS_CNAMEType"
Foreach($CNAME in $CNAMES)
{
$CNAME
$Record = Get-WmiObject -Namespace "root\microsoftdns" -Query $Query -ComputerName dnsserver | Where-Object{$_.Ownername -match $CNAME.Aliases}
$Record.RecordData = "FQDN of new IIS server"
$Record.put()
}

The script can be modified to update any kind of DNS record, so it's not locked into just updated CNAME's.

I pretty much have a bunch of CSV files that contain a single colmn called Aliases, these CSV files hold all the CNAME aliases for all our sites.  As you can see in the first line of the script I pretty much delcare $CNAMES to import in all the data from the CSV file to be used later in the script.  I then declare what kind of DNS record I'm looking for as $Query.

In order to apply the change to each row in the CSV file I needed to place the PowerShell command that will be making the change in a Foreach statement, hence the Foreach($CNAME in $CNAMES).  The next few lines are pretty much the meat and potatoes of the script and is pretty self explanitory and accurate with what you might find searching the web.

Now with the $Record.RecordData = "FQDN of new IIS server" can easily be changed to allow the person running the script to enter what FQDN to change to manually.  By simply changing that line to $Record.RecordData = Read-Host "Enter the new Target Host FQDN", the Read-Host cmdlet asks for user input on the console allowing the user to type whatever he/she wants ... what is typed in the console the script will use to modify the CNAME with.

Of course this script is available for you to use in anyway shape of form ... but I do not take responsibility if something goes wrong.  As any administrator will tell you, test first and test again.  Any script examples I post is 'use at your own risk'.  Look at what the script is doing rather than copy, paste, and execute.  Don't know what a certain parameter or commandlet does - Google search :)  Thanks.

Wednesday
03Feb2010

Download pick: Quest Software's ActiveRoles Management Shell for Active Directory

Ever since I started getting into PowerShell a co-worker pointed me in the direction of Quest Software, which I spoke about in past posts ... they not only have, probably, the best PowerShell script editor; PowerGUI, they also have the best PowerShell commands for Active Directory management/automation.

Help make your job a little easier with PowerShell and ActiveRoles Management Shell for Active Directory!

http://www.quest.com/powershell/activeroles-server.aspx

Many of the Active Directory related scripts I post on this site uses Quest Software's cmdlets ... it's truly miles ahead of having to do tasks within ADUC or through the clunky command prompt tools of the past :)

They just recently updated to version 1.3 that added a bunch of cmdlets like:

 

  • new-qadcomputer
  • set-qadcomputer
  • disable-qadcomputer
  • enable-qadcomputer
  • reset-qadcomputer

 

These new cmdlets greatly helped reduce my workload, scripts I'll be sharing with my visitors in the near future!

Give it a look!

Thursday
21Jan2010

Security Update: Vulnerability in Internet Explorer

It's been in the news the last couple of days, Microsoft has reported a new vulnerability in it's web browser, Internet Explorer.  IE 6/7/8 on Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7, and Windows Server 2008 R2 are all vulnerable.

You can find the details of this vulnerability from the following Microsoft Security Advisory:
http://www.microsoft.com/technet/security/advisory/979352.mspx 

Microsoft annouced they will release an out of cycle update for this Vulnerability, that should be released today.

There is a workaround that you can apply to your system to help protect yourself.  In the above link they mention setting the Internet zone security setting to high will protect users from this attack.  You can find this setting in Internet Options, and click on the Security tab.

This one is pretty serious ... reports link this vulnerability being used in the china-based attack on Google's Gmail service last week.

Wednesday
13Jan2010

Windows Updates Available - Time to Update!

Today Microsoft along with the US-CERT announced two important updates that fix some vulnerabilities found in the Microsoft operating system.

http://www.us-cert.gov/cas/alerts/SA10-012B.html

The vulnerabilities that were found, and are addressed in the US-CERT security alert was a vulnerability in the Embedded Open Type font engine.  The other was multiple vulnerabilities in Adobe Flash Play 6 that is included in Windows XP by default.

US-CERT recommends all users installed the latest Windows Updates available from Microsoft and upgrade (or remove) Flash Player.

So please go do your Windows Updates and keep your computer safe!

Thursday
31Dec2009

Download Pick: Microsoft's Active Directory Topology Diagrammer

As an IT professional and starting a new job you always find yourself needing to learn the new environment around you.  Most companies don’t have much documentation or design diagrams of how their infrastructure is currently setup or how it looks.  This is pretty common with Active Directory and Exchange environments.  Sure you can always fire up Active Directory Users and Computers, Sites and Services, or Domains and Trusts … but depending on the size of the environment getting all that information can take time.  Microsoft’s Active Directory Topology Diagrammer (ADTD) can help!  Running this tool you can read your entire Active Directory structure and automatically output that information into a Visio 2003 or 2007 diagram.

All you need to do is provide a domain controller, check the information you would like the tool to look for and then just hit the Discover button.  The tool will query your AD/DNS environment and provide you with a status, which you can then click Draw! and all the information will be drawn to a Visio document.

I’ve used this tool against Windows 2000, 2003, and 2008 Active Directory installations; it also seemed to work well discovering Exchange 2003 and 2007 organizations.

Every Windows administrator/engineer should have ADTD in their little bag of tools, give it a download:
http://www.microsoft.com/downloads/details.aspx?familyid=cb42fc06-50c7-47ed-a65c-862661742764&displaylang=en

 

Tuesday
29Dec2009

PowerShell: Help determine stale/unused Exchange 2007 distribution lists

Like any Exchange organization distribution lists (or groups) can easily grow out of control.  The number of distribution lists can easily hit the hundreds even for your small businesses.  There really isn't an easy way to determine whether that DL is being used or not.  Sure you can easily talk to the DL's owner (if configured), but if you are like my company you have 300+ distribution lists some with owners configured others not.  That can be a real pain in the butt, so I figured there had to be an easier way to achieve my goal to finally clean up stale/old/unused Exchange distribution lists.

Click to read more ...

Monday
14Dec2009

New game trailers = new games!

Looks like the 2009 Video Games Awards (VGAs) brought the gaming ... a whole bunch of trailers released for new games coming! Posting some of the trailers of the games I'll have to keep an eye on. Click the post to check them out!

Click to read more ...