Thursday, July 28, 2011

Getting started with Powershell


Getting Started with PowerShell
  • ·         Install power shell in your XP machine. In Windows 7 it is present by default. Download is available in the Microsoft Site. http://www.microsoft.com/download/en/details.aspx?id=7217
  • ·         launch PowerShell in start -> run by typing powershell
  • ·         Now let's a write our first script to modify the dates of the files present under the folder "C:\PowershellTest\testFiles" to current date and time plus 5 minutes on each file.
  • ·         Create a txt file and rename to "MyFirstTest.ps1". Edit the file with the below code. It adds the current time to the first file and adds another 5 min to the each file.

-----------------------------------------------------------------------------------------

#  getting the current time
$Now= Get-Date
#   Listing the files and folders under the folder
$TargetFolder = Get-ChildItem "C:\PowershellTest\testFiles"
#   For loop , variable must be preceded with "$"
foreach($file in $Targetfolder)
{
$file.LastWriteTime = $Now
#  Adding 5 min
$Now = $now.Addminutes(5)
}
#  Displays output
$TargetFolder
-------------------------------------------------------------------------------------------------------------------------------

  • ·         In PowerShell, ALL variable names must start with the "$" character
  • ·         "#"is used for comments
  • ·         You can debug the script using the powershell editor (powershell_ise.exe) which is already part of the application.
  • ·         Open command prompt and type powershell.exe. It will open up a power shell window. The result would be as shown below.

 ----------------------------------------------------------------------------------------
PS P:\> C:\Powershelltest\MyfirstTest.ps1
    Directory: C:\ PowershellTest\testfiles
Mode                LastWriteTime     Length Name
----                -------------     ------ ----
-a---         7/27/2011   8:26 AM          0 New Bitmap Image.bmp
-a---         7/27/2011   8:31 AM      12800 New Microsoft PowerPoint Presen ion.ppt
-a---         7/27/2011   8:36 AM      10752 New Microsoft Word Document.doc
---------------------------------------------------------------------------------------


  First Issue:
File MyFirstTest.ps1cannot be loaded because the execution of scripts is disabled on this system. Please see "get-help about_signing"
Reason: The security setting does not allow you to execute a script, by default the Execution Policy is set to Restricted.  This is the so-called Execution Policy
There are 4 policy levels:
  1. *      Restricted: Individual cmdlets can run, but not saved Powershell scripts. This is the default setting.
  2. *      AllSigned: Scripts can run, but must have a digital signature even if written on the local computer. Prompts you before running scripts from trusted publishers.
  3. *      RemoteSigned: Scripts written on the local computer do not need a digital signature, but any script downloaded from outside (email, IM, Internet) must have a signature to execute.
  4. *      Unrestricted: Any script can run, but scripts downloaded from outside will run with a warning.

To change the Execution Policy to Unrestricted, type the following command in Powershell
Set-ExecutionPolicy Unrestricted

Tuesday, August 17, 2010

Learning from other's Act - 2

We were a group of 5 members and assigned a set of tasks. Our Manager wanted the solution within a day. Once the meeting was over, we could realize that the task was not going get finished within a day and we decided to split the work.
I was just wondering how to divide the tasks. Immediately I saw Sreeja scribbling  some letters and it was the first letters of our name in the alphabetical order and she immediately divided the  task between us. No partiality, no confusion. Who takes first and What to be taken... Very simple approach.

Tuesday, August 10, 2010

Learning from other's Act - 1

In the evening Tea time at 12th Floor, as usual Sreeja, Roshan & I were having chit chat the very immediate day after my college Project presentation on Cloud computing. Roshan was quite curious on Cloud services and asked me to explain. Since it was vast and I was not interested to talk after 2-3 months of research on this. 

Once we were back to our workstations, Roshan came to my desk and asked me whether she could have a look at the PPT. It took only 15-20 min to explain the slides. She was going through the slides very carefully. I took 2-3 months to understand this new service area and put it into the PPTs in a simple way. But just by sitting next to me and showing curiosity she gained a knowledge which I might have gained by 1-2 months  of effort in reading all news articles, blogs etc. But it was just because of her enthusiasm to learn to areas and to approach people without any hesitation. I really liked that approach. 

"Try to interact with people, have coffee talks on your areas of interest, be in touch and gain as much as knowledge you can  from others.It is faster and simpler than learning by your experience."

Being Demanding on the team deliverables

Being Answerable to escalation and responsible for People Management and Daily delivery of the Project, Some where I couldn't score much. There was a feedback from some of the team members that I am Bossy. Is that true?

According to my basic mind set, I never liked commanding to someone. But what made me to act in that way and how I could have avoided it?

In that thought process, I felt a bit angry to My Manager being not understanding the escalation and daily delivery pressure I had been undergoing. Because One day the same manager only told me to be a very strict Lead at the same time he will be on the softer side to listen the Team and now I got a bad rating from the same manager.

Well, I will not consider it as a bad rating, rather the best eye opener to explore more areas of human feeling and behavior. I was thinking how I could have handled daily task assignment better. Again Prof Vatsal Sir gave me an insight to this problem.

He said " Nithya, be polite to the team members, Set the expectation at the beginning like the deliverables and time lines, make the him/her understand the impact on you if it is not delivered on time. And after couple of hours, take him for coffee or go to his desk and ask him  "Do you face any challenges?" "How are things going?" . A genuine person would definitely open up if he is facing any issue. The other one would feel guilty. This way you are being very assertive but ready to understand him.

"Never ask 'Why you are not able to deliver' , Instead ask "What challenges are you facing?" He concluded.

Monday, August 9, 2010

Bridging the teams

Building a relationship with an acquired company and its small teams, I never knew how difficult it was, rather I was not aware of it's importance,

I was surprised when I got a low rating for the objective "working in teams" in my appraisals because I did not utilize the opportunity to become a bridge between these two teams. I would say I didn't have the maturity to understand the situation and act accordingly.

Where did I fail? I was disturbed for many days and still... because of this unexpected baseline on my performance evaluation.

Well I got some answers from Prof Vatsal Sir's* Class in my Executive MBA which in fact gave me some relief and some answers to my never ending questions. 

My answer to the Manger for my failure in "Working in team" was I never felt the other team as part of my team. So how I would feel like considering them as team members and work with them.

The main reason is lack of unity and the culture difference where I failed to understand and accept them.
They being into the in-house service offering and suddenly changed to a totally  new customer oriented culture where every service behaves in an aggressive mode. To Tune them into this service model, to make them relaxed, to give support and make them understand how I enjoy and learn in a service company, Probably I would have failed!

Secondly, My Immaturity and  Not knowing the importance. How would I have been matured before hitting the floor?  If I understood their mental attitude, I would have acted diplomatically and controlled my emotions. Could HR have played a better role in this situation? If so it would have been a win-win situation for both the teams.

--------------------------------------------------------------------------------------------