Tuesday, July 8, 2014

PowerShell Script : Inspire Me

 

08-07-2014 16-53-56

Everyone needs motivations and inspirations in daily life.

We do feel lost without inspirations.

I love to read inspirational quotes, and I love to store inspirational quotes which I do liked the most.

As I spent lots of time on my PowerShell console, I thought to write a simple PowerShell functions, which display a random quote.

To achieve that, I have write this simple PowerShell script and I hope you will like it

This is simplest script, what I have done is :

·        Create an String Array of the Script

·        Get a Single random item from string array using “Get-Random” cmdlet.

·        Strong that random quote in to a variable

·        Then writing the variable out using “Write-Host”. You can aloso use “Write-Out” too, but “Write-Host” support colour, so do I like it.

·        It’s a function J

Sometime, scripting is not about automating the technical stuff, we can integrate script in our lives too, make a useful utilities from them.

It’s all about creativity. J Sometime in IT and sometime in Life.

Sorry for my insanity ;)

Download Link : http://gallery.technet.microsoft.com/scriptcenter/PowerShell-Script-Inspire-0c163df6

 

Inspire Me

:-------------------------------------- Script Code ----------------------------------

#==================| Satnaam Waheguru Ji |===============================   
#
# Author : Aman Dhally
# E-Mail : amandhally@gmail.com
# website : www.amandhally.net
# twitter : @AmanDhally
# blog : http://newdelhipowershellusergroup.blogspot.in/
# facebook: http://www.facebook.com/groups/254997707860848/
# Linkedin: http://www.linkedin.com/profile/view?id=23651495
#
# Creation Date : 08-july-2014
# File : Let's find Some Inspiration
#
# Version : 1
#
#
# My Pet Spider : /^(o.o)^\
#
#------------------------------------------------------------------------------------------------------------

function Inspire-Me {

# List of Quotes added in to Array
[string[]]
$quoteList =
"Do Good, Be Good, Be one.",
"Life is like a flowing river of opportunities.It's up to you to stand up with a bucket or with a spoon.",
"All the art of living lies in a fine mingling of letting go and holding on. – Henry Ellis",
"You are not YET complete. You have no right to judge yourself because you are still work in progress !",
"Wise men talk because they have something to say, Fools, because they have to say something. – Plato",
"Keep dreaming guys, they do come true. - Divine Arcanas (The Hermit)",
"If you are going to be thinking, you may as well think big. - Donald Trump",
"They told me, You Can't, I replied I Will. Divine Arcanas (The Hermit)",
"People who are crazy enough to think they can change the world, are the ones who do. - Apple Computers",
"When people underestimate you, there's a power in you to prove they're wrong. Not to prove them, but to prove yourself.",
"Anyone who judges you by the kind of car you drive or shoes you wear , isn’t someone worth impressing.",
"When things didn't go as you planned, don't be let down. Make NEW plans. The sun doesn't stop SHINNING just because of dark clouds ",
"You are never given a desire without also being given the power to make it true.",
"Do the hard jobs first. The easy jobs will take care of themselves. – Dale Carnegie",
"Success is doing ordinary things extraordinarily well. – Jim Rohn",
"Success is the sum of small efforts, repeated day in and day out. – Robert Collier",
"Attitude is a little thing that makes a big difference. – Winston Churchill",
"Flaming enthusiasm, backed up by horse sense and persistence, is the quality that most frequently makes for success. – Dale Carnegie",
"The three great essentials to achieve anything worthwhile are, first, hard work; second, stick-to-itiveness; third, common sense. – Thomas A. Edison",
"A good leader takes a little more than his share of the blame, a little less than his share of the credit. – Arnold H. Glasgow",
"Failure is simply the opportunity to begin again, this time more intelligently. – Henry Ford",
"What great thing would you attempt if you knew you could not fail? – Robert H. Schuller",
"All the art of living lies in a fine mingling of letting go and holding on. – Henry Ellis"

#Choosing One Randonm Quote
$randomQuote = $quoteList | Get-Random -Count 1

# Writing Quote
"`n"
Write-host "---|Today's Quote |---" -ForegroundColor Green
"`n"
Write-host $randomQuote -ForegroundColor Yellow
"`n"
Write-Host "---| Have a Nice day. |---" -ForegroundColor Green
"`n"
}

Inspire-Me
:---------------------------------------------
Download Link : http://gallery.technet.microsoft.com/scriptcenter/PowerShell-Script-Inspire-0c163df6
 
That's all for today. See you in my next blog post. 

Regards


Aman Dhally


Come and join my journey of : “100 Days of Self Improvement” on



Facebook: https://www.facebook.com/100DoSI 



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”.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.