Showing posts with label PowerShell GUI Application. Show all posts
Showing posts with label PowerShell GUI Application. Show all posts

Thursday, May 14, 2015

Managing Windows Server 2012 R2 Using PowerShell : Part-3 : Getting and Setting Server Name.

 

    1. Part 1 : Windows Server 2012 R2 Installation.
    2. Part 2 : Exploring PowerShell Default Settings.

5-14-2015 12-24-07 PM

Part - 3 { Information - Server Names }

In the pervious blog post, we explored few default settings and configurations of the PowerShell on the newly installed "Windows Server 2012 R2". Today we are going to explore it a little bit more.

Getting Server Name

The first thing after installing server is to either check it's computer name, or, set it's name. You must be thinking that, there should be some PowerShell cmdlet , to check the name of the server.

Arrr! No, you are wrong! There is no cmdlet to check Server name. We have a cmdlet to rename server name, but not to check the current name.

5-14-2015 12-35-03 PM

Now the question arise, "How will check the server name?",  There are two-three ways to check the existing name of the server.

  1. By using  $env:COMPUTERNAME variable in the PowerShell console. this variable stores the name of the machine.
  2. 5-14-2015 12-44-00 PM
  3. The another way to find is to run the Hostname.exe command.
  4. 5-14-2015 12-54-08 PM
  5. The another way to use the WMI, the WMI class name Win32_ComputerSystem , has a Name property which contains the name of the server .
  6. (Get-WmiObject Win32_ComputerSystem).Name
  7. 5-14-2015 12-57-29 PM

Renaming Server Name

After getting the name of the server, what is my next step is ? Guess! Guess!?, my next step is to rename the server name to something logical, and off-course, we are going to set computer name using PowerShell.

We are going to change the name of the server from "WIN-FOUM1FCL4JB" to "Del-2k12"

To rename the computer name , we do use the Rename-Computer cmdlet. To rename the server name, I have used the below command. In parameter -NewName we have provided the new desired name for our server.

Rename-Computer -NewName 'Del2k12'

5-14-2015 1-05-01 PM

In the above screenshot you can see that our command has run successfully and it is asking to restart the computer to change to take effect.

We can restart the server, but, restart it with a  PowerShell cmdlet Restart-Computer .

5-14-2015 1-05-35 PM

Once the computer is restart and I logged in again and when I checked the name of the server, it is set to "DEL-2k12"... Great!

5-14-2015 1-06-54 PM

That's all for today's blog post, we will see and do more in the next blog post.

Take care!

816

 

Regards.
Aman Dhally
If you like, you can follow me on Twitter and Facebook. You can also check my “You Tube channel for PowerShell video tutorials. You can download all of my scripts from “Microsoft TechNet Gallery”.

Monday, January 19, 2015

The story of "A! Murky Ana" , PowerShell and Me.

 

Murky_ana

She was frustrated, she seems to be pissed off, and I sense all of this from her voice when she call me on my phone, her voice pitch was high, and she was cursing her Line Manager (poor guy). Due to all of these symptoms, I call her and named her, “A! Murky Ana”. This name suites her (for time being). She was upset, very upset.

 

I meet with her few months ago, she is working as an I.T. administrator in a MNC which deals in I.T projects and “A! Murky Ana” is responsible of take care of some of the “Overseas I.T Projects”.

 

On phone, I asked her “what is the issue is?, You doesn't sound good.  

 

A! Murky Ana: “I am   tired of being an average I.T technician, I always get low pay rise, no bonus, no appreciation of the work and nothing seems fruitful. I am thinking about changing my Profession,”

 

 I said: “Ok, but I think, everyone feels the same, it’s nothing to be frustrated, we just need to learn how to deal with it and handle it. Life is not always fair, but we need to learn the ways to improve it.”

 

A! Murky Ana:You don’t know anything about it, you are PowerShell MVP, Speaker and technical reviewer of one book,”

 

I replied : “Hahahahhaah ( I laugh ), It’s just my second year of being MVP, before that,  I was the same normal IT guys like you and today, I am still like most of IT guys, I have a line manager, I keep doing the desktop support to when needed. So, I am same like you. ”

 

A! Murky Ana: “You are lucky, that you are a MVP, I can’t be MVP, and I can’t progress in my life, and I will be always like this, a normal IT, Support desk girl. There is no future for me. I am an average IT girl.”

 

I said :Henery ford said “Whether you think you can, or you think you can't-you're right”. So Don’t think negative, If you want, you can change yourself and move ahead, in your carrier and in your profession, there is no need to change it.”

 

A! Murky Ana: “How?”

 

I replied:By learning PowerShell”

 

A! Murky Ana: “How can learning PowerShell can help me?”

 

I said: “First, you are in window domain, and now, PowerShell is the core of every Microsoft Server OS, Desktop OS, and All server applications, if you master PowerShell, you can master everything”

 

A! Murky Ana: “it’s difficult”

 

I said :is there is anything in this world , which is easy?

 

A! Murky Ana : “ No!, I mean to say, “it’s a difficult to learn”

 

I asked :  what is your age?”

 

A! Murky Ana : “23 year”

 

I replied :  “Ask you  parents, when you were a kid, may be 1 year old, when you don’t know what to do, and how to do , at that that, you learn to walk, when an average child  is 1.5 year old, he learn to talk. When we were just 1 – to 1.5 year old, at that time we learn to, walk and talk, now you are 23 and you are saying, you can’t? Doesn’t it sound absurd?

 

A long Silence on the phone………

 

She replied after two minutes: “Yes, you are right”

 

I smiled over phone.(Yayyyyyyyy!!!)

 

A! Murky Ana:Ok, how can I learn PowerShell?”

 

I replied:Pick a pen and paper note it down the trick to learn PowerShell”

 

A! Murky Ana:Tell me, I am ready, I have pen and Paper”

 

I said :Get 2 books on PowerShell, first one is “PowerShell in Depth by Don Jones, Richard Siddaway and Jeffery Hicks, and second one is “Learn Windows PowerShell in a Month of Lunches by Don Jones too”

 

A! Murky Ana:Any online reference?”

 

I said:yes, search for “the scripting guys” and read articles and also check foe the “Scripting wife”, and also you can search for my  blog “New Delhi PowerShell user Group” and  you also find some basic stuff there to read”

 

A! Murky Ana:Do you think, I can learn that?”

 

I replied: “Lao Tzu said : The journey of a thousand miles begins with one step.”

 

A! Murky Ana: “Right”

 

I said:Start now, starts small, and take a small step, just begin it, and one day, you might be PowerShell MVP too, that’s how I did start”

 

A! Murky Ana:All fine, but, how can this will be beneficial for my carrier?

 

I replied:Ok!, if you learn PowerShell, You can automate things, You will do the manual task less and will write more scripts, and these days , the person who knows PowerShell scripting, and who knows how to automate things they are in high demands , as by doing, automation they are saving lots of man hours. “

 

A! Murky Ana: Seriously?

 

Me:Yup”

 

A! Murky Ana:Ok, give me some time and will get back to you soon, thanks for your time and thanks for motivate me”

 

Me: “No worries, my pleasure, see you soon.”

 

& she hang up the phone………………….

 

* All characters appearing in this work are fictitious (Apart from ME and the Author of the books and the online reference on the blogs). Any resemblance to real persons, living or dead, is purely coincidental.

 

 

 Regards.

Aman Dhally
If you like, you can follow me on Twitter and Facebook. You can also check my “You Tube channel for PowerShell video tutorials. You can download all of my scripts from “Microsoft TechNet Gallery”.