Cisco PIX VPN Setup for Windows 7 & Vista x64

July 16th, 2010

Alright, sorry it took so long to put the rest of my Vista x64 setup on here.  Here’s part 2 – configuring Cisco PIX VPNs for Windows Vista & Windows 7 64-bit machines.  To start, Cisco is dropping support for PIX devices and ASA is definitely a more robust device anyway.  Cisco has stated they will not be creating a 64-bit VPN client for Vista or 7, you will have to upgrade to the ASA device for your VPN to use the new 64 bit client.

There is a freeware open-source program that will connect to a PIX VPN with minimal configuration, though.  The program is called vpnc-fe.  simply download and install the application, then follow these steps to ensure connectivity.

Make sure you install the OpenTAP driver when installing, this driver is used to create the virtual interface that the VPN will tunnel through.

This program is a little strange at first, in that there is no interface that shows when you run it, it is just an icon in the bottom right.

screenshot

Right-Click it to open the menu, goto options> Import PCF.  Here you can specify the PCF file you would normally use for the Cisco VPN client.

Now, there’s about a 50% chance you are good to go.  I had to make some other changes as well.

If you are able to connect and reach your office network by IP, but DNS is not working, just add these as your pre-and disconnect scripts:

pre-script:

netsh interface ip set dns name = “Local Area Connection” source = static addr = <insert your internal primary DNS server here>
netsh interface ip add dns name = “Local Area Connection” addr = <insert your internal secondary DNS server here>
netsh interface ip add dns name = “Local Area Connection” addr = <insert a public DNS server here(4.2.2.2)>

Disconnect Script:

netsh interface ip set dns name = “Local Area Connection” dhcp

Save those as batch(.bat) files in the C:\Program Files(x86)\VPNC Front End\ directory.  Then right-click the vpnc-fe icon and goto > options > Connection Settings > Scripts ta.  In the appropriate lines, just put the name of the scripts, not the full path, as it only looks in the directory above.  Try connecting and your DNS woes should be over.scripts

If VPNC shows you are connected, but you cannot reach anything by any means, it probably didn’t properly create the routes.

For this, I was lucky enough to have 2 machines, one XP x86 with Cisco client that worked, and one Vista x64 that didn’t work.  I just did route print and compared to find the issue.  If this is an option, it is your best bet.  Here is a rather slim overview on what I did.  Please ask me questions, it has been a couple of months, though, so I don’t remember everything, but if you ask me questions, I can work with you to get yours set up.

OK, so open a command prompt after connected and type “route print”.  Take a look at your interfaces, find the one labeled “TAP-Win32 Adapter V9″.  If it doesn’t show, you may need to enable it and run route print again(it should be enabled if you are connected, though).

First, if you see any routes for 169.254, add these to you pre-connect script:

route DELETE 169.254.0.0
route DELETE 169.254.255.255

Now, look for any references to your network, generally, the routes are created, but without the right mask or interface specified.

Find those, and delete them as well:

route DELETE <Your companies network>
route DELETE <your company’s network(we have 5 subnets that we connect to, so 5 of these)>

Now, you will need to create those routes with the proper info.  At the end off your script put:

route ADD <Your companies network> MASK <the mask in format 255.255.255.0> <the gateway that your VPN is connecting to internally, IE the gateway of the virtual network created during the tunnel creation, not the public IP for VPN)> METRIC 2 IF <the number of the interface “TAP-WIN32..”>

Here is an example as it should look:

route ADD 192.168.64.0 MASK 255.255.252.0 10.0.0.1 METRIC 2 IF 12

Again, let me know if you have any problems or questions, I had some other tweaks for different issues, but it has been a couple months so give me a problem and I can try to work through it with you.

Here is a complete script as an example:

netsh interface ip set dns name = “Local Area Connection” source = static addr = 172.21.1.20
netsh interface ip add dns name = “Local Area Connection” addr = 4.2.2.2
netsh interface ip add dns name = “Local Area Connection” addr = 172.21.1.41
netsh interface ip add dns name = “Local Area Connection” addr = 4.2.2.3

route DELETE 169.254.0.0
route DELETE 169.254.255.255

route DELETE 172.21.1.0
route DELETE 172.21.1.0

route ADD 172.21.1.0 MASK 255.255.248.0 10.0.0.1 METRIC 2 IF 12
route ADD 172.21.1.0 MASK 255.255.252.0 10.0.0.1 METRIC 2 IF 12

route DELETE 192.168.64.0
route ADD 192.168.64.0 MASK 255.255.252.0 10.0.0.1 METRIC 2 IF 12

Share and Enjoy:
  • email
  • Print
  • Digg
  • Reddit
  • del.icio.us
  • StumbleUpon
  • Ping.fm
  • LinkedIn
  • Facebook
  • Twitter
  • Google Bookmarks
  • Live
  • Blogplay
  • Add to favorites
  • blogmarks
  • Mixx
  • Blogosphere News
  • Diggita
  • Diigo
  • DotNetKicks
  • eKudos
  • Fark
  • Faves
  • FriendFeed
  • Gwar
  • HackerNews
  • Internetmedia
  • laaik.it
  • LinkaGoGo
  • LinkArena
  • Linkter
  • MisterWong
  • MSN Reporter
  • MyShare
  • MySpace
  • Netvibes
  • NewsVine
  • Posterous
  • RSS
  • Slashdot
  • Suggest to Techmeme via Twitter
  • Technorati
  • Tumblr
  • Wikio IT
  • Yahoo! Bookmarks
  • Yahoo! Buzz

Know No Stranger Presents

May 19th, 2010

Sorry I have been posting a little off-topic lately, but there has been a lot going on lately.  My wife graduated from Herron School of Art & Design, we opened a print shop/gallery in downtown Indy, and now she has been featured in a new e-zine called Know No Stranger Presents.  Know No Stranger is a collective of artists, musicians, actors, and dacers from throughout the midwest.  Here is a link to the article:

Know No Stranger presents

Share and Enjoy:
  • email
  • Print
  • Digg
  • Reddit
  • del.icio.us
  • StumbleUpon
  • Ping.fm
  • LinkedIn
  • Facebook
  • Twitter
  • Google Bookmarks
  • Live
  • Blogplay
  • Add to favorites
  • blogmarks
  • Mixx
  • Blogosphere News
  • Diggita
  • Diigo
  • DotNetKicks
  • eKudos
  • Fark
  • Faves
  • FriendFeed
  • Gwar
  • HackerNews
  • Internetmedia
  • laaik.it
  • LinkaGoGo
  • LinkArena
  • Linkter
  • MisterWong
  • MSN Reporter
  • MyShare
  • MySpace
  • Netvibes
  • NewsVine
  • Posterous
  • RSS
  • Slashdot
  • Suggest to Techmeme via Twitter
  • Technorati
  • Tumblr
  • Wikio IT
  • Yahoo! Bookmarks
  • Yahoo! Buzz

Wordpress mySQL troubles

May 6th, 2010

This was an issue caused by my own carelessness.  I have a script to just do a tar backup of my entire system to an external drive every night.  The script is this:

#!/bin/bash
OF=/mnt/backup/backup$(date +%Y%m%d%H%M%S).tar
mount /dev/sdb1 /mnt/backup
rm /mnt/backup/log.txt
touch /mnt/backup/log.txt
tar cvfW $OF / –exclude /mnt/backup –exclude /mnt/backup2 –exclude /proc –exclude /sys –exclude /dev –exclude /tmp > /mnt/backup/backup.log
find /mnt/backup/ -mtime +10 -exec rm {} \; > /mnt/backup/cleanup.log
umount /dev/sdb

It mounts the external drive, then backs up the system drive, then removes old backups.  Pretty simple.

If the external drive is not present to be mounted, tar continues on to do the backup to the /mnt/backup directory, even if the drive is not mounted at that directory.

So last night, I removed the drive for another purpose, since nothing has changed on my system in the past day.

Well, the backup process proceeded and filled my hard drive.  Luckily, it did not completely crash, and honestly, I probably wouldn’t have immediately noticed had I not needed to update a page for one of my client’s sites.  After uploading the page to the server, I noticed it was simply displaying a blank page.  I uploaded again and noticed filesize kept saying 0kb.  I proceeded to check things out and discovered that my hdd was full.  After some digging, I realized my mistake.  I removed the backup and life things returned to normal… almost.

My wordpress installation now showed all comments, tags, plugins, everything… except for the posts.  I was confused.  Everything seemed fine.  I decided to take a look at the mySQL database.

To login to your local mySQL db:

mysql -uroot –password=<root password> <databasename>

At the mySQL command prompt, I simply tried to see what I could pull from the posts table(for a diagram of wordpress database, see this.)

select * from wp_posts;

This returned the error:

“ERROR 145 (HY000): Table ‘<table name>’ is marked as crashed and should be repaired”

So, I tried a quick repair on the table:

repair table wp_posts;

and all was good in the world.

Share and Enjoy:
  • email
  • Print
  • Digg
  • Reddit
  • del.icio.us
  • StumbleUpon
  • Ping.fm
  • LinkedIn
  • Facebook
  • Twitter
  • Google Bookmarks
  • Live
  • Blogplay
  • Add to favorites
  • blogmarks
  • Mixx
  • Blogosphere News
  • Diggita
  • Diigo
  • DotNetKicks
  • eKudos
  • Fark
  • Faves
  • FriendFeed
  • Gwar
  • HackerNews
  • Internetmedia
  • laaik.it
  • LinkaGoGo
  • LinkArena
  • Linkter
  • MisterWong
  • MSN Reporter
  • MyShare
  • MySpace
  • Netvibes
  • NewsVine
  • Posterous
  • RSS
  • Slashdot
  • Suggest to Techmeme via Twitter
  • Technorati
  • Tumblr
  • Wikio IT
  • Yahoo! Bookmarks
  • Yahoo! Buzz

Wake Press Opening Friday, May 7

May 5th, 2010

We are pleased to announce that Wake Press will be opening this Friday in Fountain Square, Indianapolis.  We will be opening with a collaborative show by the Senior printmaking students from Herron School of Art & Design.

Wake will be offering commercial printing as well as a gallery space for emerging artists.  I will have more info. coming soon.  We don’t yet have our window signs in, but there are flyers up in the windows, to help you know which building it is.

Wake Press is located across from the Indianapolis Museum of Contemporary Art in the Murphy Arts Building of Fountain Square.  We are next to Joe’s Bike Shop.

Click the address below for a map to Wake.

1058 Virginia Ave.,

Indianapolis, IN 46203

Share and Enjoy:
  • email
  • Print
  • Digg
  • Reddit
  • del.icio.us
  • StumbleUpon
  • Ping.fm
  • LinkedIn
  • Facebook
  • Twitter
  • Google Bookmarks
  • Live
  • Blogplay
  • Add to favorites
  • blogmarks
  • Mixx
  • Blogosphere News
  • Diggita
  • Diigo
  • DotNetKicks
  • eKudos
  • Fark
  • Faves
  • FriendFeed
  • Gwar
  • HackerNews
  • Internetmedia
  • laaik.it
  • LinkaGoGo
  • LinkArena
  • Linkter
  • MisterWong
  • MSN Reporter
  • MyShare
  • MySpace
  • Netvibes
  • NewsVine
  • Posterous
  • RSS
  • Slashdot
  • Suggest to Techmeme via Twitter
  • Technorati
  • Tumblr
  • Wikio IT
  • Yahoo! Bookmarks
  • Yahoo! Buzz

Visual Studio Team Suite 2005 on Vista 64 bit

April 21st, 2010

This post may simply be a product of my own ignorance, but hopefully it can help someone else out there in a similar situation.

So recently I was tasked with setting up a Vista Business 64-bit laptop for a developer in our office.  The needed applications are as follows:

SQL 2005 – full reporting and management tools

SQL 2008 – full reporting and management tools

VS Pro 2005

VS Pro 2008

VSTS 2005

VSTS 2005 add-on for database developers

Cisco VPN Client to connect to PIX

Office Suite

Adobe Fireworks CS4

I was told that the VSTS 2005 would not install on 64 bit Vista.  Well that right there made me want to do it.  I wasn’t about to let a new machine with 8GB of RAM go to waste by putting a 32-bit OS on it.  I started by installing the following applications in this order(they can be picky, so please be sure to do in this order):

Vista SP1

Vista SP2

SQL 2005

SQL 2008

VS Pro 2005

VS 2005 Team Explorer – (may not have been necessary, but it didn’t hurt anything and I didn’t try the process without)

VS Pro 2008

VS Pro 2008 SP1

VSTS 2005

VSTS 2005 SP1

VSTS 2005 SP1 Update for Vista – *

VSTS add-on for database developers

* – This is critical.  Without this, the VSS cannot connect to TFS server and Team Suite will not work.

Now, first off, UAC is a pain.  Unless you have modified your local security policy to run all administrators with elevated privelages, and turned off UAC, you will likely have VS 2005(any version) and SQL 2005 fail to install.  The error given can be anything from XP SP2 is not installed to permissions issues.  To avoid this, do two things.  I think you only need to do one or the other, but I did both, just to be safe.

Copy the contents of the install disks to the hard drive before running setup

Right-click and run setup as administrator

You should have no issues now with the initial installers going though.  At this point, I was confused, as the developer had copied over a project and all the related files to his C: drive and was attempting to launch it, but it kept giving an error

Unable to connect to server.

Then it prompts me to remove source control data or temporarily work offline.

Neither of these were viable options.  The strangest part was that I could goto Tools>Connect to TFS and see the projects on the server.

After speaking with someone on the MSDN forums, I realized that the issue was that there was no local path specified for source control to download files to.  If you go to the Source Control node in the Team Exploere window, find the path for the solution and open it, it will prompt you for a location to download the source files to locally and proceed to download them and open your solution.  The problem all along was that we were trying to access the solution that was copied over thinking it would find the TFS server and not actually downloading the source from TFS.

Like I said, possibly my own ignorance, but it was annoying enough that hopefully I save someone else the headache.  Let me know if you have any questions or issues and I will do my best to answer them.  I will try to post my solution for getting the Cisco Pix VPN to work on Vista x64 here in the next week.

Share and Enjoy:
  • email
  • Print
  • Digg
  • Reddit
  • del.icio.us
  • StumbleUpon
  • Ping.fm
  • LinkedIn
  • Facebook
  • Twitter
  • Google Bookmarks
  • Live
  • Blogplay
  • Add to favorites
  • blogmarks
  • Mixx
  • Blogosphere News
  • Diggita
  • Diigo
  • DotNetKicks
  • eKudos
  • Fark
  • Faves
  • FriendFeed
  • Gwar
  • HackerNews
  • Internetmedia
  • laaik.it
  • LinkaGoGo
  • LinkArena
  • Linkter
  • MisterWong
  • MSN Reporter
  • MyShare
  • MySpace
  • Netvibes
  • NewsVine
  • Posterous
  • RSS
  • Slashdot
  • Suggest to Techmeme via Twitter
  • Technorati
  • Tumblr
  • Wikio IT
  • Yahoo! Bookmarks
  • Yahoo! Buzz

DNS Records Disappearing

February 26th, 2010

This post is a little confusing, but it may help someone out there.  In a recent security audit, we were told to disable several services on our servers, one of which was DHCP.  Before disabling it on each server, I verified they were manually configured.  We have some that are set by DHCP with a static.  I then proceeded to disable DHCP on all of the servers with manually configured NICs.

After a couple hours, we had 1 server that could no longer be reached.  of course it was a fairly critical web server.  After investigating, we could reach it in our Indianapolis location, but not Albuquerque.  The server was physically in ABQ.  I started thinking it was a network issue.  Also, the external users that access it from outside our firewall could still reach it.

After looking through the network and trying to see what changed, we realized the server no longer had any records in DNS in ABQ.  How does one record get removed from DNS like that, I thought?  After getting DNS back to how it should be, we started investigating what caused the DNS change.

Finally, we realized the server was using dynamically updated DNS, instead of a manually entered static record…  Never ever did it cross any of our minds that DHCP was keeping the DNS record updated, but it was.  The DHCP service on Windows machines automatically registers with DNS regularly.  This I knew, but I didn’t know that DHCP will register with DNS even if none of the interfaces on the machine are obtaining an address from DHCP.  Interesting.

So, before you disable that service, make sure your DNS records are manual entries and didn’t just come from DHCP’s dynamic updates.

Share and Enjoy:
  • email
  • Print
  • Digg
  • Reddit
  • del.icio.us
  • StumbleUpon
  • Ping.fm
  • LinkedIn
  • Facebook
  • Twitter
  • Google Bookmarks
  • Live
  • Blogplay
  • Add to favorites
  • blogmarks
  • Mixx
  • Blogosphere News
  • Diggita
  • Diigo
  • DotNetKicks
  • eKudos
  • Fark
  • Faves
  • FriendFeed
  • Gwar
  • HackerNews
  • Internetmedia
  • laaik.it
  • LinkaGoGo
  • LinkArena
  • Linkter
  • MisterWong
  • MSN Reporter
  • MyShare
  • MySpace
  • Netvibes
  • NewsVine
  • Posterous
  • RSS
  • Slashdot
  • Suggest to Techmeme via Twitter
  • Technorati
  • Tumblr
  • Wikio IT
  • Yahoo! Bookmarks
  • Yahoo! Buzz

Find Tables Missing Indexes and Create Clustered Indexes for Them

February 24th, 2010

**Update at bottom**

OK, so we had a SQL 2005 database that we migrated from another company.  The application that uses it as a backend was having some terrible performance issues.  We had limited information on the previous configuration, so we bumped the Application up to a newer server since it seemed most of the load issues were with that part.  Afterwards, there were still performance issues and timeouts.  SQL was queuing up commands and taking too long to process them.  So we got the senior DBA involved to help us see what kind of performance increases we could get on the SQL server.  Unfortunately, I did not note all of the changes, but this was the biggest improvement.

We found out that the previous company also had performance issues.  When looking at the tables, we noticed many did not have indexes.  This little query was a lifesaver.  It shows you which tables are without an index, how many reads/writes and if things are queuing.

SELECT

migs.avg_total_user_cost * (migs.avg_user_impact / 100.0) * (migs.user_seeks + migs.user_scans) AS improvement_measure,

‘CREATE INDEX [missing_index_' + CONVERT (varchar, mig.index_group_handle) + '_' + CONVERT (varchar, mid.index_handle)

+ '_' + LEFT (PARSENAME(mid.statement, 1), 32) + ']‘

+ ‘ ON ‘ + mid.statement

+ ‘ (’ + ISNULL (mid.equality_columns,”)

+ CASE WHEN mid.equality_columns IS NOT NULL AND mid.inequality_columns IS NOT NULL THEN ‘,’ ELSE ” END

+ ISNULL (mid.inequality_columns, ”)

+ ‘)’

+ ISNULL (’ INCLUDE (’ + mid.included_columns + ‘)’, ”) AS create_index_statement,

migs.*, mid.database_id, mid.[object_id]

FROM sys.dm_db_missing_index_groups mig

INNER JOIN sys.dm_db_missing_index_group_stats migs ON migs.group_handle = mig.index_group_handle

INNER JOIN sys.dm_db_missing_index_details mid ON mig.index_handle = mid.index_handle

WHERE migs.avg_total_user_cost * (migs.avg_user_impact / 100.0) * (migs.user_seeks + migs.user_scans) > 10

ORDER BY migs.avg_total_user_cost * migs.avg_user_impact * (migs.user_seeks + migs.user_scans) DESC

The second column is a query string generated by the first query that will create indexes based on what is needed.  A note though, that query only creates standard indexes.  I recommend to change it to create clustered indexes.  They are considerably faster.  Here are the commands I used to create our indexes.

CREATE CLUSTERED INDEX cix_MASTER1_HISTORY on MASTER1_HISTORY(mrID)

CREATE CLUSTERED INDEX cix_MASTER1_DESCRIPTIONS on MASTER1_DESCRIPTIONS(mrID)

CREATE CLUSTERED INDEX cix_MASTER1_TIMETRACKING on MASTER1_TIMETRACKING(mrID)

CREATE CLUSTERED INDEX cix_MASTER2_HISTORY on MASTER2_HISTORY(mrID)

Hopefully this helps some of you out there

**Updated 3/1/2010

This query to find indexes is dynamic.  it doesn’t actually find all tables missing indexes, it finds tables that are CURRENTLY being searched without indexes and ranks them based on the performance problems they are causing.  So run this query when your SQL starts getting backed up.

Share and Enjoy:
  • email
  • Print
  • Digg
  • Reddit
  • del.icio.us
  • StumbleUpon
  • Ping.fm
  • LinkedIn
  • Facebook
  • Twitter
  • Google Bookmarks
  • Live
  • Blogplay
  • Add to favorites
  • blogmarks
  • Mixx
  • Blogosphere News
  • Diggita
  • Diigo
  • DotNetKicks
  • eKudos
  • Fark
  • Faves
  • FriendFeed
  • Gwar
  • HackerNews
  • Internetmedia
  • laaik.it
  • LinkaGoGo
  • LinkArena
  • Linkter
  • MisterWong
  • MSN Reporter
  • MyShare
  • MySpace
  • Netvibes
  • NewsVine
  • Posterous
  • RSS
  • Slashdot
  • Suggest to Techmeme via Twitter
  • Technorati
  • Tumblr
  • Wikio IT
  • Yahoo! Bookmarks
  • Yahoo! Buzz

How To Seize FSMO Roles and Clean Up Failed Domain Controllers In Active Directory

December 18th, 2009

Alright, so I think at some point, every SysAdmin will have a domain controller fail.  Every SysAdmin should also know that unless you run dcpromo.exe to demote a domain controller before removing it from AD, you can have some issues.  From FSMO to DFRS, it’s just not a good situation.  Here is a summary guide on how to clean up AD after one of your Domain Controllers fail.  Also, this looks long, but it’s all very simple, just putting it into step-by-step sort of drags it out, so no worries, this should be about a 30 minute process.

USE CAUTION: Improperly using ntdsutil may result in partial or complete loss of Active Directory functionality… Don’t go exploring without doing your research.

STEP 1:

Finding Current FSMO Role Masters

First, We need to know whether that particular server was holding any of the FSMO roles.  To check this, we have a couple options, Either via the GUI(1), or via ntdsutil(2).  Personally, I prefer to do it via ntdsutil, as I always feel that there is more power in the command line.  Also, I just hate using a mouse. There are other options, but these two are all that I will cover in this post. For more you can look into “netdom” or “replmon” tools from microsoft, these are not included in windows by default, so I will overlook them for now.  (NOTE: For this, I definitely recommend ntdsutil, as in step 2, I will expect it to already be open and connected.  the GUI Method, is more for information.)

Method 1:

Open AD Users and Computers.

Right-click the name of the domain you are wanting to look at, then select Operations Masters.

FindFSMO1

From this view, you can determine the current Domain-Specific RID Master, PDC Emulator, and Infrastructure Master FSMO Roles.

Now, open AD Domains and Trusts,

Right-click the AD Domains and Trusts in the nav. pane and go to Operations Masters.  This will show you the Domain Naming Master Role.

Finally, to find the Schema Master, you will have an extra step.   You will need to register the Schmmgmt.dll library first.

Goto: Start>Run and type:

regsvr32 schmmgmt.dll

Hit Enter, you should see a success message.

Now, that should allow you to open a new console: AD Schema.  To open it, goto: Start>Run, type:

mmc

hit enter.  Now, in the management console, goto File>Add/Remove Snap-in> click Add.  Double Click Active Directory Schema and close the add/remove dialog windows.

Now, right-click the AD Schema icon and goto Operations Masters.

Method 2:

To check the FSMO Roles via the command line using ntdsutil, we will need to do the following.

Alright, let’s open up a command prompt, then type

ntdsutil

and hit enter.

at the ntdsutil prompt, you will type

roles

hit enter.

Now, you should see a screen that says “fsmo maintenance”.  type

connections

and hit enter again. Here you will connect to the server you want to become the FSMO master(localhost works, if thats what you want). So type:

connect to server <FQDN of server>

and hit enter again. now you will leave the server connections page and go back to fsmo maintenance. Type:

q

Now we should be back in fsmo maintenance, type

select operation target

Hit Enter. Then type:

list roles

Once you hit enter, it should show you the servers that hold each role.
FindFSMO2

Type “q” to get back to fsmo maintenance, but stay at this screen for the next step.

STEP 2:

Seizing FSMO Roles From Dead Server

OK, so this step is optional.  based on the results of your last step.  You only need to seize the roles if the FSMO master is no longer operational.  To do this step we will use ntdsutil.

Now, we need to seize the roles that are on our dead server.  You should know what roles your dead server holds from the last step, so only do this command for those.  Remember, I had you connect to the server that will receive the FSMO role(s).  A quick way to see the syntax for seizing is just type “?” and it will show you how to transfer/seize, it is basically:

seize <role>

as in:

seize schema master

or for transfers(only to be done if current master is still live/active)

transfer <role>

To verify the roles transferred(ignore the errors you get at first, you are guaranteed to have one since the current master is unavailable), put in

select operation target

then the same way we found the masters before:

list roles for connected server

Now, we’re almost done, we have transferred the FSMO roles(the biggest potential problem), and just need to cleanup the AD metadata and sites/services.

STEP 3:

Metadata Cleanup

For the next step, we will go back to the first ntdsutil prompt.  type “q” and hit enter until your prompt says “ntdsutil:”.  Type

metadata cleanup

hit enter. You should still be connected to a domain controller, but if you closed ntdsutil and reopened it, you will need to put in

connections

then

connect to server <servername>

then type quit back to the metadata cleanup prompt (”q”). Now, we will pick our target for cleanup. Type:

select operation target

At this point, if you only have 1 domain, or within the domain you pick, only 1 site, you can skip some steps. Your domain number, site number will be “0″(zero) if there is only one. For the sake of thoroughness, I will show you how to find the index anyway. To find the domain, type:

list domains

Now, find the domain you want to work with, and type:

select domain <number>

Now, we find the site within the domain where the domain controller used to reside.

list sites

put in the site you want:

select site <number>

To find the servers within that site, type:

list servers in site

then we will select the inactive server by typing:

select server <number>

Now, type enter “q” to quit back to metadata cleanup prompt. The final command to cleanup all metadata for that server is:

remove selected

You will receive a warning, but if you’re positive that server is down and will need rebuilt, you should be safe to hit Yes.  You should get a message saying it was removed successfully.  If you receive an error that the object could not be found, it was probably already removed from the domain controller.  Open up AD Users and Computers to verify the server is gone from the Domain Controllers OU.  Alright, we’re almost done, just another 5 minutes of work, at the most.

Step 4:

Remove The Server From Sites & Services

This will be done via the AD Sites & Services Snap-in.  Just expand the site where the server was located, and delete the object for the failed server… This step is done.

Step 5:

Remove The Server From DNS

This step depends a lot on how you have your DNS set up, I am assuming the DNS is run on a Windows server, and hopefully a DC.  It doesn’t have to be, that’s just how i prefer it.  Unfortunately, where I work, The DNS servers are separate and I have no access to them… such a pain.  Anyway, open up your DNS Management Console.  I hope you know this, but it’s:
Start>run> type “mmc”, hit enter. Goto File>Add/Remove Snap-in>hit Add>double-click DNS>Close>Close.
Now, expand the zone where the server used to be(probably Forward Lookup Zones>domain.local), and delete the A record(also called a host record) for the server. Remove the CNAME record in the _msdcs.root domain of forest zone in DNS. If you have reverse lookup zones, also remove the server from these zones. If you have anywhere else the server is referenced, or are unsure, you might want to check for these now.

You’re Done!  Now, you should be good to go.  Let me know if any of you have issues with this guide, notice anything wrong, or just have errors/questions.  I will be glad to help, and I know I have some pretty atrocious grammar/spelling at times.

Share and Enjoy:
  • email
  • Print
  • Digg
  • Reddit
  • del.icio.us
  • StumbleUpon
  • Ping.fm
  • LinkedIn
  • Facebook
  • Twitter
  • Google Bookmarks
  • Live
  • Blogplay
  • Add to favorites
  • blogmarks
  • Mixx
  • Blogosphere News
  • Diggita
  • Diigo
  • DotNetKicks
  • eKudos
  • Fark
  • Faves
  • FriendFeed
  • Gwar
  • HackerNews
  • Internetmedia
  • laaik.it
  • LinkaGoGo
  • LinkArena
  • Linkter
  • MisterWong
  • MSN Reporter
  • MyShare
  • MySpace
  • Netvibes
  • NewsVine
  • Posterous
  • RSS
  • Slashdot
  • Suggest to Techmeme via Twitter
  • Technorati
  • Tumblr
  • Wikio IT
  • Yahoo! Bookmarks
  • Yahoo! Buzz

Error Logging in VB and C#

December 17th, 2009

Alright, so lately I have been working on a couple of ASP.NET(C#) projects.  One thing I have seen is nothing is as useful as having a good error logger.  Now, since I am still in the learning phases of .NET programming, I have been looking to a coworker, Joe Young, sort of as a mentor.  He provided me with some code that has just immensely helped me.  I have attached 2 files.  one in VB, on in C#, they are Joe’s code.  These are your App_Code files.  They will create a detailed log of any errors in a file in a directory you specify.  You specify the file in the attached files.  To use them, you will insert the following code. (For the below VB examples, I used a website to convert it from my C#, as I was being lazy)

C#:

private void LogError(Exception errMessage)
{
errorlogger objLog = new errorlogger();
objLog.logerror(errMessage);
}

VB:

Private Sub LogError(ByVal errMessage As Exception)
Dim objLog As New errorlogger()
objLog.logerror(errMessage)
End Sub

This allows you to call the external errorlogger.

Now, to call it. The most useful place I have put these are in SQL connections/procedure calls. Here is an example from one of my programs.

C#

try
{
string strSQLSetCheckedOut = “exec CP_setCheckedOutTrue ” + HttpContext.Current.Session["sName"].ToString();
SqlCommand conSQLCommand = new SqlCommand(strSQLSetCheckedOut, conSQLConnection);
conSQLCommand.CommandTimeout = 120;
conSQLConnection.Open();
conSQLCommand.ExecuteNonQuery();
}
catch (Exception ex)
{
LogError(ex);
}
finally
{
conSQLConnection.Close();
}

VB:

Try
Dim strSQLSetCheckedOut As String = “exec CP_setCheckedOutTrue ” & HttpContext.Current.Session(”sName”).ToString()
Dim conSQLCommand As New SqlCommand(strSQLSetCheckedOut, conSQLConnection)
conSQLCommand.CommandTimeout = 120
conSQLConnection.Open()
conSQLCommand.ExecuteNonQuery()
Catch ex As Exception
LogError(ex)
Finally
conSQLConnection.Close()
End Try

Hopefully this little bit of code out there will help someone else out.

C# ErrorLogger Code

VB ErrorLogger Code

Share and Enjoy:
  • email
  • Print
  • Digg
  • Reddit
  • del.icio.us
  • StumbleUpon
  • Ping.fm
  • LinkedIn
  • Facebook
  • Twitter
  • Google Bookmarks
  • Live
  • Blogplay
  • Add to favorites
  • blogmarks
  • Mixx
  • Blogosphere News
  • Diggita
  • Diigo
  • DotNetKicks
  • eKudos
  • Fark
  • Faves
  • FriendFeed
  • Gwar
  • HackerNews
  • Internetmedia
  • laaik.it
  • LinkaGoGo
  • LinkArena
  • Linkter
  • MisterWong
  • MSN Reporter
  • MyShare
  • MySpace
  • Netvibes
  • NewsVine
  • Posterous
  • RSS
  • Slashdot
  • Suggest to Techmeme via Twitter
  • Technorati
  • Tumblr
  • Wikio IT
  • Yahoo! Bookmarks
  • Yahoo! Buzz

Moving

November 3rd, 2009

Just to let everyone know, I am moving my blog off to my own server. The new address will be blog.christophermichaelwebb.com. I had resisted for quite a while as wordpress has some powerful clout on the search engines, but I feel it’s for the best as I like to have full control over my sites. Hope to see you all there.

Share and Enjoy:
  • email
  • Print
  • Digg
  • Reddit
  • del.icio.us
  • StumbleUpon
  • Ping.fm
  • LinkedIn
  • Facebook
  • Twitter
  • Google Bookmarks
  • Live
  • Blogplay
  • Add to favorites
  • blogmarks
  • Mixx
  • Blogosphere News
  • Diggita
  • Diigo
  • DotNetKicks
  • eKudos
  • Fark
  • Faves
  • FriendFeed
  • Gwar
  • HackerNews
  • Internetmedia
  • laaik.it
  • LinkaGoGo
  • LinkArena
  • Linkter
  • MisterWong
  • MSN Reporter
  • MyShare
  • MySpace
  • Netvibes
  • NewsVine
  • Posterous
  • RSS
  • Slashdot
  • Suggest to Techmeme via Twitter
  • Technorati
  • Tumblr
  • Wikio IT
  • Yahoo! Bookmarks
  • Yahoo! Buzz