Showing posts with label Windows Server. Show all posts
Showing posts with label Windows Server. Show all posts

Friday, September 5, 2014

SBS 2003 Active Directory Restore

I was tasked a few months ago to P2V a few windows servers that were part of a small domain for a small doctors practice.  That practice had merged with the Hospital I work for a few years back and they kept their old Physical servers with their domain and EMR system on them to access the EMR for historical patient records.

Well... needless to say the hardware started approaching 8 years of age and failing on one of the servers.  We wanted to virtualize them into our VMware infrastructure in our secure datacenters.  Now I have done a lot of P2V's in my day of servers as VMware became the standard and old systems needed to be kept around, or otherwise simplified.  I have NEVER had a P2V corrupt Active Directory in a domain controller.

I proceeded to take an image of all three servers using an older version of Acronis True Image that I had hanging around.  The servers were a terminal server, the EMR server and the SBS 2003 server.  All are part of a domain that is controlled by the SBS 2003 server.  The users in this practice on the Hospital LAN access the terminal server which is where we installed their EMR application.  They are authenticating to that terminal server via the SBS 2003 server.  Needless to say, I took hot images of all three servers and everything went fine.  Even the P2V of the servers using VMware's converter tool worked like a champ.  The terminal server booted fine, and the EMR server booted fine.  However, the SBS 2003 server booted with the following: security accounts manager initialization failed directory service cannot start

I was a little worried at this point.  I tried numerous things that are pretty typical.  Booted into safe mode... same error.  I did a quick google search and everything came back in the results as a corrupted Active directory.  I was sitting OK however, because the old Physical servers were still running.  But they were ticking time bombs.

I thought: "perhaps I should take a cold image (boot to a disc so windows is not running) and take an image that way so the AD database is not changing like it can during a hot image.  I started this process only to have the power go out on us 2 hours into the 4 hour process.  So I put on my big boy boots and started to go down the road of restoring AD without a backup.

I spent several hours pouring through Microsoft documentation, tech net articles and forums to get the help I needed.  I came up with a mixture of a few solutions.  Here are the steps that ended up working for me, because I was getting errors in Active Directory restore mode pertaining to the Jet Database.

  1. Restart the server and press F8 key, select Directory Services restore mode.
  2. Log in with the local administrator username and password
  3. Type: cd \windows\system32
  4. Type: NTDSUTIL
  5. Type: files
  6. If you encounter an error stating that the Jet engine could not be initialized exit out of ntdsutil.
  7. Type: cd\
  8. Type: md backupad
  9. Type: cd \windows\ntds
  10. Type: copy ntds.dit c:\backupad
  11. Type: cd \windows\system32
  12. Type: esentutl /g c:\windows\ntds\ntds.dit
  13. This will perform an integrity check, (the results indicate that the jet database is corrupt)
  14. Type: esentutl /p   c:\windows\ntds\ntds.dit
  15. Agree with the prompt
  16. Type: cd \windows\ntds
  17. Type: move *.log c:\backupad   (or just delete the log files)
This should complete the repair.  To verify that the repair has worked successfully:
  1. Type: cd \windows\system32
  2. Type: ntdsuti
  3. Type: files   (you should no longer get an error when you do this)
  4. Type: info   (file info should now appear correctly)
One final step, not sure if it’s required:
From the NTDSUTIL command prompt:
  1. Type: Semantic Database Analysis
  2. Type: Go
There you go!  Hopefully nobody has to use this article as server 2003 is almost at End of Life, but I know that there will be instances where some legacy applications will Keep Windows 2003 in datacenters for many more years.

Monday, May 6, 2013

Access Terminal Server Farm behind firewall WITHOUT RD GATEWAY!!!

In my last post I showed how easy it is to setup an RDS (terminal services) Farm.  You also will find out just how well it works... on your internal network.  The problem I quickly discovered is what seemingly almost every other person discovered when they setup a RDS Farm... accessing it from outside is not as simple as using an RDP client and logging into one of the terminal servers.  The behavior you will get is that it may or may not connect you.  When it does connect you to a RDS server it connects you exactly to the one you specified and other times it will not connect you.  This may lead you to believe that the Broker is not doing its job, but in fact it is.  If you look at the log files for the broker sessions on the Broker server at: EventViewer > Applications and Services Logs > Microsoft > TerminalServices-RemoteConnectionManager > Operational > TerminaServices-SessionBroker you will see that the broker is indeed doing its job and passing you to the RDS server it believes is less utilized based on load and connections.

Great... so you know its not the broker so what is it?  Well... you are outside the network and your Broker as well as your RDS servers are all addressed for your internal network.  Quick logic tells you to simply create a NAT rule on your firewall for all your RDS servers.  Unfortunately that won't work because your Broker is still telling your RDP client to go to another server whose IP address is  on your internal network.  When you are outside your network your RDP client is not going to find that internal network.

I cannot tell you how many things I have tried based on logic and what other users posted in forums.  The one trend you will see with 98% of the answers to solve this problem is to use the RD Gateway.  I agree that is the best solution especially because its more secure.  I would even suggest to anyone to do this.  However, on the network I work on we have over 20,000 devices on our network and a lot of them are Mac OS X devices.  The Microsoft RDP client for Mac OS X does not work with TS Gateway.  I know there are other RDP clients out there for the Mac OS that do work with TS Gateways but the good ones cost some coin so we wanted to avoid that if possible.

So here we go... To make your RDS Farm work for users outside your network you need to configure a NAT rule for each terminal server on your firewall.  They have to be separate outside IP's that you own and can put in your firewall and NAT'd to the internal IP of an RDS server.  So these will be a one-to-one NAT not a one-to-many... if you do a one-to-many you will basically create a loop for your broker.

Next, on each RDS server add a second NIC. (Easy for me because I run all VM's on VMware).  For our environment we created a new Vlan for these NIC's to be sure they did not talk to the firewall and have ARP freak out over a conflicted IP address because of those NAT rules we just created.  Address each of the second NIC's with the outside IP address that corresponds to the NAT rule you created.  (i.e. Use the outside IP from the rule for TS01's because thats NAT'd to the internal IP of the same hostname).

Next be sure to go into each RDS servers and add that second address and NIC to be used in the Farm.  Open up Server Manager and go to: Roles > Remote Desktop Services > RD Session Host Configuration: SERVERNAME.  Under the "edit settings" section open up "Member of farm in RD Connection Broker".  The window where it says "Select IP Addresses to be used for reconnection" you should now see that second network adapter with that outside IP you gave it.  Select it and "OK" your way out.  Be sure to do this on each RDS server only.  YOU DON'T NEED TO DO THIS STEP ON THE BROKER!!!


Thats it!  Now your RDS servers are sending the login requests to your broker with each of its IP addresses,  and in turn your broker will send the RDP client your connecting from two IP addresses for the RDS server in the farm it wants you to connect to, the internal IP and the external IP!

See the diagram below for the visual representation.


I will note that the IP's in the diagram are not my own but used for the purposes of visualizing the solution.

Some notes:

- You do not need to add any additional DNS entries to your internal DNS servers for the RDS servers or farm name that contain the outside IP addresses.
- For us we made the Vlan the second nics are connected to a "dead" Vlan.  Meaning nothing routes or from it.  We had to do this so that all the ESXi hosts on our network could Vmotion the RDS server VM's to each other and have them still communicate on those second NICs.
- Nothing on the firewall is routed to those second NICs, nor should there be.  You don't want a direct connection to the second NIC of your RDS servers from outside if you can help it.  (I read a post where someone solved this problem by doing just that).  That's why we NAT the outside IP to the internal IP of each server.
- Don't believe any post that talks about using a Microsoft Loop Back adapter on the RDS servers... it does not work.
- Don't even begin to think you can simply edit the local "hosts" file on these servers to accomplish this task.  It won't work.

There you go.  This was a 3 day long, brain-bending problem for me.  In the end it was one of the most gratifying solutions I have done in IT!

Cheers!

Friday, May 3, 2013

RDS Farm setup (formerly Terminal Services Farm).

Its been a few months since my last post but that time has not seen me idle by any means.  ;)

Today is going to be the start of a lengthy one followed but another, but one that definitely warrants it because it appears there are a lot of other Admins who ran into my situation but could not figure out how to overcome the final hurdle.

(From here on out I will refer to terminal services as RDS which is Microsoft's new name for that role... Remote Desktop Services).

Our network consists of 150ish servers, 8,000ish users and about 250ish vlan's.  We are a big organization to say the least.  We have never really had a widespread need for users to use RDS.  That changed recently when the software company that does our payroll system (which does timekeeping, vacation time, sick time and of course payroll decided to move to a cloud solution).  Most end users (such as myself) only use a web portal to request time off, enter hours or view their pay stubs.  Other users such as managers, payroll staff and the accounting staff have to have an application installed to do their managerial and payroll tasks in the system.  The problem being is that we have a lot of staff that are on Mac's and the client application for this system is not compatible with Macs.  To top it off, the team that installs applications on the users' computers does not like the idea of having to go to a bunch of PC's and install this application.  So the idea of RDS is brought up to me.  Which of course prompts me to think of the amount of users that would be using this RDS so my thoughts turn to high availability and future growth/needs of RDS.  Enter and RDS farm project!

Setting up the RDS farm was very simple.  I already had one RDS VM for my departments use.  I simply cloned it twice and changed the SID on it after installing the new client application for our new payroll system.  After renaming the clones and joining them to the domain, I setup the farm.

I do not yet have a need for the Published web apps side of RDS so I will focus here on the install of the RDS farm utilizing only the Session host service so users can log into the RDS servers the old school traditional way we think of a "Terminal Server".

Let me quickly explain the role of the "Broker" in an RDS Farm.  The broker is basically the traffic cop for RDS connections.  It keeps the RDS logins between the servers in the farm balanced based on connection and load.  Some people in smaller environments will put this service on one of their RDS servers but in larger environments it will be best to put it on its own server.  I setup three RDS servers and wanted the capability to grow the farm, so I want this service to be separated from a server that end users will log into.

For the record, as of this post the Microsoft RDP application for Mac OSX is not compatible with Server 2012 RDS so I used Server 2008r2 for all the servers in the farm.  I know there are very good RDP apps for MACOSX that will work with server 2012 (iTap) but the good ones cost money which our organization is not favorable of.

To start, create your broker VM or server.  Its as easy as installing the Remote desktop services role and choosing only the "Remote Desktop Connection Broker" service.


Click next all the way through accepting any dependencies that need to be installed.

Once that role is installed on the broker you need to go into the local users and groups on that server and add all the RDS servers that will be in your farm to the group named "Session Broker Computers".



 Before adding the Servers you will need to select "object types" and select "computers" so the names or IP's of the servers resolve.




Now type in the name or IP of your servers you plan to use in the RDS farm to be added to the group.  ***NOTE: YOU DO NOT NEED TO PUT THE SERVER WITH THE BROKER ROLE IN THIS GROUP UNLESS IT TOO IS A RDS SERVER YOUR USERS WILL USE".

Thats it for the Broker! There is nothing else to do here!

Now we will install the roles and configure the servers that the actual users will be using.

On each RDS server you want the users to use you need to install the "Remote Desktop Services" role with just the "Remote Desktop Session Host" service.


Accept all the defaults that follow.

Now we need to configure each server for the farm!

In the server manager drill down to the "RD Session Host Configuration".


Now we will be working under the "Edit Settings" window.  In licensing you need to configure your licensing.  I have user CAL's for our environment and have the licensing server setup on another server in our domain.  On your terminal servers you just have to specify that server that is doing the licensing service.


Next, in this same window we need to open "Member of farm in RD Connection Broker".

The properties window that opens up needs the following: The name of your server you setup for "RD Connection Broker" and a name for your RDS Farm in "Farm Name".  This is the first time you have named the farm so call it what you wish, but you will need to make sure that you use the same farm name in all the terminal servers with the session host service.  This is also how you would create multiple farms with the same broker server managing them.  So each server with the same farm name is in the same farm.  (I hope that explains it well).  "Check Participate in Connection Broker Load-Balancing"  Also, in the window for "Select IP address to be used..." you want to select your NIC that should have your static IP of the server listed.  Leave the setting for "Relative Weight of this server in the farm" to its default.  This is the actual connections it will allow on this server.  If you have older hardware or are worried about the performance of the RDS server you would drop this down so it would eventually deny connections to keep performance stable.  Im running on Virtual machines so Im not worried about this as I can give the VM's more memory or processors if needed.


OK... final step.  Your going to need to create a DNS record for each IP address of your RDS session host servers with the name you gave your farm.  For example: if you have two RDS Session servers with the IP's of 192.168.1.10 and 192.168.1.11, and you named your Farm "TS-Farm" on each RDS Server, you need to create two DNS A records on your internal DNS server for each of those IP's with the name "TS-Farm".  This is so when the Broker sends your users out to find a RDS server to log onto it knows what servers are in the farm.  It uses DNS round-robin which by default is on for server 2008 and 2012 domain controllers.  I will assume you know how to do this step since its a common admin task and I would be blacking out a ton of stuff in the pictures at this point.  :)

To use the farm simply have all your users log into the same RDS session host server.  You don't have to give your users all the names or IP's of the servers in the farm.  Better yet, make an A record on your internal DNS server called something like: remote.yourdomain.com and point it to just one of the IP's of a session host in your RDS farm.  What happens is when a user uses an RDP client with that address, the server will pass the request to the broker and the broker will send the client to any of session host servers in your farm based on load and/or session count.  So they won't always end up on that one server you have all the users logging into based on the IP or CNAME record.

Thats it!  You know have a terminal server farm.  If you want to have fun, watch the logs on the broker to see the broker do its work.  For each session request you should see up to 4 records.  You will see how the broker handles it and ultimately puts the user on the selected destination session host.  The ones you want to watch for fun are found in server manager at: EventViewer > Applications and Services Logs > Microsoft > TerminalServices-RemoteConnectionManager > Operational

***Note*** If a user disconnects a session instead of logging off, the broker will always put them back to the same session host they left their disconnected session at.  Its good to setup a good Group Policy for your terminal server so users are locked down from doing damage to the entire server.  I even put things in my policy to terminate sessions that have been disconnected and idle for 8 hours.

Like I said, this part was very easy.  I spent three days with our Network Administrator working out getting the farm to work from outside our network.  What you do here with these instructions will work flawlessly on your internal network.  Everything else you read in forums at Microsoft and other places on the net from other admins is that they finally settled on a RD Gateway to get the farm to work outside their network.  YOU CAN GET THE FARM TO WORK OUTSIDE YOUR NETWORK WITHOUT A RD GATEWAY!!!  I will show you how to do this in the next post.  We spent many, many hours troubleshooting with trial and error but we did get it working and anyone can do it.  I will try and get this posted for you next week.

Cheers!

Thursday, November 29, 2012

Veeam Server 2012 Deduplication

I posted roughly a couple weeks ago some first impressions of Veeam.  I ended up deploying a Server 2012 Standard VM to use as my final Veeam server.  The reason is because of the built in deduplication that server 2012 can do on its volumes.  I wanted to share my results after a week of running.


I am highly impressed!  I am saving 1.72TB of data after Veeam does its dedup magic!  We have roughly 13TB of raw data in our VCenter so you can see that Veeam with server 2012 (both doing dedup magic) uses well less than half that data for a 30 day retention.  It was very straight forward to setup and I highly recommend anyone who is using a similar solution as Veeam running on a windows server to look at upgrading the server OS to server 2012 to save some space on your backup discs!

This entire solution costs us roughly $42k.  The san we use for the backups is a simple HP san with 24TB of storage.  This was roughly $20k cheaper than a solution I was quoted that used Veeam with Data Domain, and much cheaper than Avamar which was over $100k.  Both of those solutions would have provided much better deduplication alone without Veeam's built in dedup, but the built in dedup from server 2012 was able to save us some money for a dedup solution that is not all that bad!

Cheers!

Friday, September 14, 2012

Server 2012

I had a chance to stand up a VM running server 2012.  I was fearful that the GUI would be the same as Windows 8 and I was right.  The start menu has been replaced by the tile desktop look.  I did not play with it too much as I was turned off by this.  The only real benefited upgrades from server 2008 are to do with Hyper-V which I am not a fan of.  Perhaps Microsoft has made some strides in the virtualization world, but this VMware fanboy will stick to what works!