How To Windows

Amazing world of dependencies !!

It has been while since I posted anything. Mainly not because I was not learning anything new, but it is because I am not getting enough time nowadays (or in other words, I just got a life now :D). But then I realized that time and time, I like to read my old post to fix some really odd issue and if I don’t keep record of troubles I had in past, I might forget them again. So I decided to find time to write often… it’s my new mid year resolution :D… lets see if I stick to this or not.

Recently I was playing with Windows 2016 Server in our test environment as part of testing it’s viability for our application suite. And so if you have ever worked with .NET Framework project you know that sometimes it can be royal pain to work if there is a version difference between Framework you have installed and Framework project is expecting.

Something like that happened with me in this case too. I need to have Framework 4.0 and Win 2016 has 4.6 installed by default. So against my better judgment, I decided to uninstalled .Net Framework 4.6 from system. It did let me uninstall it just fine but when I rebooted system, it failed to start Server Manager because guess what !! It was depending on .NET Framework 4. So I thought OK, I can download installed from Web and install it using that. But nooooo, since it’s part of OS now you can’t run installer and install framework from there. So I had catch 22 case. I can’t install .NET Framework from installer because it’s part of OS (and you have to use server manager) And you can’t start server manager for installation because you need .NET Framework 4 !!


How To SQL Server

Monitoring SQL Server using Alerts

There are many after market tools available to monitor health of SQL Server. But with help of built-in tools you can actually create some pretty neat solution by yourself too. And one of the most handy tool is “Alerts” in SQL Server. With help of Alerts you can monitor SQL Server Events, Various Performance Conditions and oddly WMI events !! And what great thing about it is you can setup it to notify users and / or run specific job (stored in SQL Agent) to handle specific event.

It is very simple to setup Alerts using SQL Server Management Studio (SSMS). Since Alert notification uses Database Mail, you need to have a valid mail profile in order to be able to sent notifications. You can actually use your gmail account for testing. While back I did post about it.

First you need to create an operator which will receive an alerts via Email or  Net Send or Pager. You can create new operator in SSMS –> SQL Server Agent –> Operators. Right click on Operators and select “New Operator”.

It has two simple parts, in 1st General part you provide way you want to get notification … be it Email, Net Send Address or Pager. Furthermore you can setup pager schedule. For demo, I will be using my Gmail account as operator email.

How To SQL Server

Send emails using Database Mail … from SQL Server

Back in Pre SQL Server 2005 editions of SQL Server there was nice feature called SQL Mail which basically allowed users to send email from within database server. But that system has many dependencies and major one was requirement of Microsoft Exchange… thus usage was severely limited to enterprise customers who has resources to setup such a system. When MSFT released SQL Server 2005 they introduced new feature called Database Mail which replaced SQL Mail … and they removed all kind of external dependencies. Now all you had to do was to provide just SMTP server and you are all set !!

I always thought that I have blogged about process to setup Database mail but it appears that I never did so today I am going to write about step-by-step process to setup / configure database mail. Since we have moved on from 2005 to 2008 to 2008R2 to 2012 …. I am going to use SQL Server 2012 edition but process remains same for previous editions too.

Database Mail can be found under “Management” group in SQL Server Management Studio. To configure Database Mail right click on it and select “Configure Database Mail” which will start configuration wizard. It will show bunch of options like “Set up Database Mail”, “Manage”, “Change system parameters”. Since we have not setup this before we are going to select first option, “Setup Database Mail by performing following tasks”. And with that selected click next.

How To Windows

Setting up Domain Controller in Virtual System … Part II

So after setting up Domain Controller (DC) next step is to configure workstations and add them into newly created Domain. It is actually not that difficult part but during my early trials I spent quite a bit time to make these workstations connect to DC. Because even though they were part of same network they were not able to “see” DC because they had different DNS and it took me while to figure that out.

Anyways, first step is to setup fixed IP of workstation. And make sure that in it’s DNS, use IP of DC.

How To Windows

Setting up Domain Controller in Virtual System … Part I

If you are like me, who like to “experiment” with random software downloaded from Source Forge, CodePlex or anything alike … on top of working on bunch of side projects in different work environments … and you have a “bug” in your mind which make you learn anything and everything .. then I am sure that you have always craved to have a domain controller of your own .. I mean imagine about trying different networking theories to server-client application development to database management … In love

But biggest issue with having personal Domain Controller is you need separate hardware which you can use as a domain controller and it has to be running all the time which could be biggest constraint for many follow IT Professionals and if you are cheapskate like me then you probably have very nice machine but just 1 or 2 machines (not talking about puny laptops … but bigass desktops)… and you want to get as much juice as you can get from that beast (!!) . But if you are not that serious then you can actually use one virtual machine to be as Domain Controller and many other virtual machines as your toys. And in this post I am going to show step by step how to do that ….

To my surprise there are not many “how to” available about setting up domain controller using virtual machines .. hack they don’t have much posts about setting up DC with real hardware !! So it took me real long .. and many tries to have some proper machine to have working domain controller (some were due to unforeseen side effect of using virtual machine). Mainly because this process is not as straight forward as it seems (or that’s what networking guys makes you think Open-mouthed smile)… Okey enough babbling … now the process ….

First you need a good clean virtual machine with new SIDs. Alternatively you can create your own clean image using SYSPREP (built into Windows). I can’t stress enough that if you have an existing image of virtual machine make sure that you use this SYSPREP to prepare nice clean image and use THAT image to setup DC otherwise you will run into weird issues and you will spend hours scratching your ….. head Winking smile. I am using evaluation edition Windows Server 2008 R2 Enterprise, because later on I also want to setup 2 node cluster but that will take some time Smile for now just stick with current task at hand … setting up virtual Domain Controller.

If the image is created using SYSPREP then once booted, it will do some installation and configuration of OS.

Domain Controller 1 Domain Controller 2 Domain Controller 3
How To Installer Tools

Editing MSI with OCRA

If you have worked with MSI then you probably know that it uses an internal database to store all kind of information and you can actually directly modify this information by using a great tool OCRA. It is tiny utility released by MSFT.

But unfortunately it is not “that” simple to get OCRA because it is not available as separate download , instead it is part of Windows SDK. Which means that if you want OCRA you have to download whole Windows 7 SDK. And even after downloading whole 1.4 Gb ISO, this tools is not easily visible. Once you download ISO (for x64 bit download), either make DVD or mount it as virtual drive (my preferred option) then go to \Setup\WinSDKTools_amd64 and open up Inside that you will see WinSDK_Orca_Msi_5E20C107_DAA3_4D49_AFAE_7FB2594F0CDC_amd64 , extract that file and add extension .msi to it. And that is your installation for OCRA !! I really don’t know why such a great tool is hidden so deep by MSFT (and it is not the only great tool neglected by them). Once you install it you will see an additional entry “Edit with OCRA” in context menu whenever you right click on MSI.

How To Tips

Remotely execute file on another machine

As usual, I was searching something over internet and going through random crap to look for something (I don’t remember now what was that) and I somehow found that there is really great utility available in good ol’ Sysinternals Suite which literally allows user to remotely execute any application on another machine !! That utility is called PsExec.

Honestly in past sometimes I really had wished that if there is some kind of tool available which can run some program on remote machine so that I don’t have to do something crazy. But I always assumed that it simply is not possible for whatever reasons and so it crossed my mind to even search for something.

Use of this tool is actually pretty simple. And like may other tools of Sysinternals suite this one too doesn’t have any GUI to interact with. Users are required to feed bunch of parameters in order to make it work. And it is very possible that it will not work in first try because of missing parameter. To get list of all parameters you can simply run exe on command prompt and you will see something like this …