Playing with String in PowerShell

As being a Windows Administrator I use PowerShell every day and the best part of it is, I learn something new every day. In simple word PowerShell can make your life easier, and I think you all agreed with it. I often requested to pull various reports from various sources and it was not always possible to get the exact report by executing one or more cmdlet. Sometimes had to manipulate certain strings from cmdlet output or reading some specific log files for generating reports. Here I will share my experience on how we can easily working with strings in PowerShell.

TASK – 1: Validate the target computer is located in Non-Prod OU or Not.

First I kept the Computer Object LDAP path to $InputComputerName variable using

Now I have to split the variable with “,”, so that I will be getting it into the following order.



Now you can each line by using [0], [1], [2], and exactly here I need the value of second line, so I used [1]

Now again I am splitting this with “=”

No I am selecting second line with [1] to get the current OU location and mission accomplished J

Continue reading

How to boot Windows Server 2016 Technical Preview with GUI (Server with Desktop Experience) from VHD

The reason behind writing this article is to use my Laptop (having Intel i3 4th Gen and 8 GB of RAM) as my LAB for testing new Windows Server 2016 TP4 and to do that I have to use boot from VHD option. There are multiple ways to boot your system from VHD but I don’t find a simple and effective one. Second reason is I wanted to boot the Windows Server 2016 TP4 with GUI (aka Desktop Experience), coz I like the new Windows GUI.

So, let’s get started.

First, you have to download the Windows Server 2016 TP ISO from here. Once downloaded, extract the ISO content to a folder (I have extracted to C:\MyData\WinSvr2016). Now you have to create a VHD and mount it with any available drive letter (I selected V). Use the following set of command one by one from PowerShell or Command prompt with administrative privilege.

Continue reading

How to Quit Smoking

logo_wecanstopsmoking1

Quit smoking is really tougher than we thought, but not Impossible. And If I can do it, I am pretty much sure that you can also do it. Today, I am going to share my experience with you on how I quit smoking.

We always need some short of motivation to perform any task. This motivation could be anything, but if there was nothing to motivate, it is highly possible that you will end up with failure. So, if you really want to quit smoking, first you have to motivate yourself. If you are a smartphone user, you can download any of the following application depending on the OS installed on your smart phone.

    

I personally use Windows Phone (I am a big fan too), so I downloaded the KickSmoking application. In this application (on others too) you can easily set basic details such as how many cigarette you smoke daily/weekly, from when you will quit smoking, how much one cigarette packet cost, and the currency. Once you configured the app, you can give it a try for quit smoking.

Continue reading