Thursday, April 26, 2012

HTTP redirect in IIS6

When you install a web app, it often times installs to a virtual directory, which means that instead of browsing to http://server, you have to browse to http://server/app. It used to be that I would simply setup a META redirect in the default.html page to redirect the browser, I learned today that isnt the optimal method, nor does it always work.
As I was setting up a redirect for a site, I found that some browsers worked and some didnt. Also, the security settings appear to impact the types of redirections (relative or absolute) that are allowed. A little googling and I found http://exchange.mvps.org/owaredirect_frames.htm. This is for IIS5/6, and it is a little easier in IIS7.

Gratuitously copied and pasted below in case the content gets retired.

How do I redirect the default web site to /exchange ?

1. Log onto the OWA server
2. Open the IIS Manager
3. Open the properties for the default web site
4. Under the Home Directory Tab, do the following
a) Choose redirection to a url
b) Type /exchange in the text box
c) Check the "directory under this one" radio button
5. Click "apply", "OK", and exit the IIS manager.
6. Test the changes by opening a web browser, and connecting to the www root folder.  It should now take you directly to the Exchange Logon screen.


Monday, April 23, 2012

My take on the recent Vision Trip to Honduras



To properly describe my recent trip to Honduras, I first have to start by detailing my trip last year. Last year we had a work trip, with the goal of helping out at the school and doing some sort of work project. The project we were involved in was helping to build a house. There were over 20 of us that went: men, women, and children, all together in a school bus.
Every day the school bus would drop us off at AFE in the morning, and then I and 2 other men would travel to the work site where we worked closely with a handful of locals. None of us from the states were particularly skilled in construction, so we easily took direction from the foreman and other locals. As expected we ran into translation issues, but the scope of our work was somewhat limited, so it was easy to manage. After the morning was done, we would travel back to the school for lunch, then back to the house for a few more hours. When the day was done we went to the hotel and cleaned up and got ready for dinner.
During our few days there, we were able to get an amazing amount of work accomplished. Even though we didn’t make it a goal to accomplish so much, in 1 week we took a concrete slab and made it a fully functional house with 2 bedrooms and a kitchen/living space. It felt great to accomplish so much and know that a deserving family would benefit greatly from our efforts.
After I got home and the post-mission trip glow faded, I began wondering if I really helped by going down there. Surely the locals could have completed the job just as well, and the cost of my travel, hotel, and food could have provided better tools that would have made the job easier and faster. Additionally, everyone else in our group kept talking about how great it was to connect with the kids and how much they look forward to seeing them again. All I ever saw was the work crew, they were great guys, but I wouldn’t go out of my way to see them again.
I spoke with Pastor Rey about what I could truly help with and he suggested that I would be able to help people in the dump community just by being there. Being involved in Bible studies, helping the kids, and just being friends was the most important things I could do.

Once the discussion for a new trip came up I decided that if I go, I would focus on being with the kids, not on building something. I would still build if needed, but it wouldn’t be my primary goal. I was delighted when I heard that this wasn’t going to be a Mission Trip, or a Work Trip, but rather a Vision Trip. We weren’t going to focus on how much we can get done, but on making friends and sharing of ourselves. I was in…
So when asked what I “accomplished” during this trip, all I can say is that I painted a couple of windows, something that could easily be accomplished in an 8 hour day, not 12 people over 6 days. The real question is who did I impact, and I think that would be a couple hundred kids. Just by playing with them, being friends with them, and being there I made their lives a little better, and possibly changed them permanently for the long run.
I was personally impacted by how open the kids at AFE were and how open they were to me as a stranger. Minutes after arriving on campus we went to the auditorium and I sat down in the crowd, immediately a boy named Wilson scooted over to me, grabbed my hand, and held onto it. He didn’t want me to entertain him, he didn’t need me to teach him, or be anything special, he simply wanted me to love him. Even though I don’t know him, speak his language, look like him, have any candy, or anything else, he wanted me. As the week went by, similar situations happened with different kids, while playing, taking pictures, or just sitting in the shade, I was amazing how open their hearts were to allowing a gringo into their lives.

One of my favorite quotes is from the movie Return of the Jedi, “You're going to find that many of the truths we cling to depend greatly on our own point of view”. While at AFE and the surrounding dump community I found lots of great people, lots of resources, and lots of beauty, but I also found a point of view that was, for lack of a better term, stuck. During this trip I learned how just a few well-chosen words to a child can possibly change a point of view, or at least open them to another point of view. Now I understand what Pastor Rey meant by saying that being there was one of the most important things I could do.
Now I am looking forward to our next trip. The only concern I have now is how much time I am able to spend there. Between work schedules, and the schedules of the rest of the team, I may only succeed in getting to spend 1 week a year. If this were an ideal world, I would be able to take a 3 month sabbatical and spend more time getting to know the people there, and of course learn how to speak with them


Cross posted to http://blog.edgoad.com and http://wcafe2012.blogspot.com/

Wednesday, April 11, 2012

Change storage pathing in ESX5

In ESX4 I used a script to cycle through the available datastore paths and set the connection type to round robin. In ESX5 it changed a bit, so this is the updated script





param([string] $server = $(throw "Server param required")
,$user,$pass)

if ($user -eq $null)
{connect-viserver $server}
else
{connect-viserver $server -User $user -Password $pass}

$esxcli = Get-EsxCli
$esxcli.storage.nmp.path.list() | group-Object -Property Device | where {$_.count -ge 4} |  %{ $esxcli.storage.nmp.device.set($null, $_.Name, "VMW_PSP_RR")}
$esxcli.storage.nmp.satp.set($null, "VMW_PSP_RR", "VMW_SATP_ALUA_CX")

disconnect-viserver $server -confirm:$false

Thursday, April 05, 2012

Automating multiple RedGate restores

I recently had the task to do a DR restore several SQL databases using RedGate backup software. The software is incredible and does things very well, but I had to restore 3 servers each with dozens of databases - not something to be done by hand. Here are a few tricks I learned during the process.

Getting the server ready:
This was a DR restore, so I had the server, file system, and system state, but no active SQL databases. The first step was to get SQL running and restore the MASTER database. To get SQL running I built out a VM and setup a vanilla install of SQL. I then copied the master, model, dist, msdb, mssqlsystemresource, and temp databases. SQL then started successfully.
Once SQL was running, I restored MASTER. Start SQL in single user mode (sqlservr -m -c) and use RedGate's sqlbackupc.exe command as shown below:
    sqlbackupc -sql "restore database master from disk='path' with replace"

Taking databases offline:
Because the databases dont already exist, we need to take them offline prior to being able to restore. This can be done manually, right-click database | Tasks | Take Offline, but for dozens of DBs, there has to be a better option.
I ended up creating the TSQL script below, then cut and paste the results into another query.
    select 'alter database [' + name + '] set offline with rollback immediate' from sys.databases

Restoring databases:
Now the fun of restoring the databases. All the files were stored on a remote share, and using a similar process to taking the DBs offline, I was able to automate the restores. This time copy and paste the results into a command window with pathing to the RedGate tools
    select 'sqlbackups -sql "RESTORE DATABASE ' + name + ' FROM DISK=' +''''+ '\\server\directory\*.sqb' +''''+ ' WITH REPLACE"' from sys.databases

Once restored, the databases come back online automatically