Uncategorized Windows

Export–Import Windows Firewall Setting using PowerShell

Something I really hate is to do same thing again and again manually … and so I always try to automate that task using scripting … weather it is simple Batch Script … VB Script … Bash .. or my new favorite PowerShell Open-mouthed smile. What I really like about PowerShell is, it exposes whole .NET stack to you and you can do just about anything you can do in any .NET application … but with lot simplicity (should I add … without need to build whole project !)

From past few months I am beginning to get involved in more system preparation tasks for our production and one of the requirement is to configure Windows Firewall to have some rules for our application. And we have to repeat this process on any machine that goes into production. At one point I realized that if you keep doing something repetitively chances are you will make mistake at some point and you will not notice it until you run into some issue and you back trace your steps !!

Then I found that all of these machines have same configuration in them both hardware wise and software wise … and they will also have same firewall exceptions. So it would be nice if I can seamlessly import – export firewall rules from one machine to another machine. Actually this can be done via UI from Windows Firewall with Advance Security (which can be reached by opening up Windows Firewall in control panel and then clicking on “Advanced Settings”). And there you should see two options, Import Policy and Export Policy. And those options does what they say … import / export firewall policy.

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 Virtualization Windows

Use of SYSPREP to duplicate windows image with new SIDs

From past some time I am trying to create windows domain in home computer with bunch of VMs using Windows Server 2008 R2 for “educational” purposes Open-mouthed smile … my ultimate goal was to setup clustered windows system and have SQL Server in that environment. I want to lean about how SQL Server behaves in clustered systems and what are ups ‘n downs of any clustered system … like OS updates, SQL Server updates, SSIS – SSRS behavior in failover, system crashes etc … I mean you can always lean by reading but I think it gives better idea when you can actually test those theories on some kind of test system Nerd smile

So, by following few blogs, MSDN helps and forums … I was finally able to install and configure everything properly … I had working domain too … but when you try to setup windows cluster, it is recommended by MSFT to validate cluster before setting it up. Which basically runs bunch of tests like check all nodes, their hardware, their compatibility, storage system, network settings etc … and if any test fails then you have to fix that issue before setting up cluster. And if you are not too savvy about these items then it is really painful experience.

So when I tried to run this test .. it failed at one particular point where it validates system configuration. Unfortunately I don’t have screenshot of this error so I can’t show detailed message but it had something to do with system settings. I tried to look for this error and I was not able to find any definitive answer until I found an answer in stackoverflow which mentioned that it could be because of SIDs !

.NET How To Windows

Setting up personal Source Control Server using Visual SVN Server

I was working on one of my personal projects and I thought that it would be really cool if I have my own source control mechanism so I can always rollback to older versions if I ever need to do it. Till now, I was always just keep multiple copies of each project so if I have to rollback or even just have to compare files then I just open them up and compare it. But with my prolonged exposure to SVN, I found that it is more easy if I have some sort of source control server, I can use it to keep all of my repositories and it will make my like more easy. So just last night I finally completed that task.

Tools of trade,

To setup dedicated Visual SVN Server I used virtual machine with Windows 2008 Server (having 16 Gigs of RAM really helps Open-mouthed smile). Just make sure that machine has static IP, because DHCP will have random IP of machine and then it could be wonky for SVN Server.

Babbling How To Windows

Becoming administrator of my own machine !!

I know, it sounds strange. But it is fact that when we install Windows 7 or Vista (say any non-server post XP OS ?), and even if select ourselves as local administrator we actually don’t become administrator !! And due to that even if you disable that notorious UAC notifications you will still sometimes need to run apps as admin by right click and say “Run as Administrator”.

Enable_Admin_2Now, it is really annoying and I feel helpless that even though MSFT says I own my system, I still not own it ?? When I says I want to be an administrator that means I want to be an administrator, and I don’t have to run any stupid program with elevated privileges by right clicking on it.

Ofcourse being a Linux user I am sort of habituated with these annoyance of Administrator and Power user. And I truly believe that sometimes they are very useful to have specially for users who don’t know much about computers and have administrator rights to screw system up (well, even if they don’t have admin rights they still screw system up, but that is another subject of conversation Open-mouthed smile)

One of my favorite “How To” site, has posted a way to enable real Administrator account in Windows 7 and I am sure it is not recommended for general user, but for power users it is really useful.

How To Windows

Removing Favorite, HomeGroup and Libraries from Explorer in Windows 7

I like Windows 7. No doubt that it is better than Windows Vista at few aspects (but still XP was the best Smile, I really miss search of XP). With new UI, Windows 7 has add new options in Windows Explorer like Favorites, HomeGroup and Libraries. But I personally believe that they are just a noise, I prefer more simpler view.

So after Googling, I found that I am not the first to dislike this UI. And there are literally number of posts about how to remove those options from Explorer. I am just consolidating methods that worked for me.

Note: Editing registry can make system unstable, so do take backup before modifying registry entries. Easiest way will be to backup select File –> Export from menu. Alternatively, you can choose to export only entry which you will modify.