Gave this presentation in May, 2010 at Wipro internal KM sessions. Was going through my blog and found this @ http://blog.ankitk.com/2010/05/my-powershell-presentation/ :)
Hi All!! Before We begin today’s KM tech talk, I have something for you guys! Any Guesses? …… Hmm!
After Q2: I promise you that after this ppt, many of you will start believing in it. B4 moving on my third q, I make an assumption that many among us have gone through some Unix training, class or at least have heard about it. After Q3: Today, Windows dominates the world OS market by having 91% market share. The obvious reason of the initial success of Windows was its simple, lucid GUI. It seems that Nobody wants to work with text based interfaces or Apps. So moral of this answer – GUI Rocks -> Next Slide
Now once the operating system got a GUI , ppl started asking for GUI based Apps also. Various Apps which previously were Command line, got an GUI avatar. The Basic reasons for the success of GUI were: PPTSo is GUI a universal solution for dealing with the computers. Can we go for GUI approach in every scenario. Yes or No. Actually there is a classic answer for these kind of questions “It depends!” -> Next Slide
Lets have example of my brother. He uses his system primarily for internet, movies, songs. All these features need a good GUI. Imagine checking ur mail thr’u command line or a command line browser or a media player. But now imagine a FMG Admin of Wipro. His job is to create new user-id for Wipro mail, manage them and delete whenever required. Suppose he want to create 100 new joinees ID. Now if he start creating them through Exchange server GUI , it will take at least 25 hours. In practice, these admin people use a script, commonly written in scripting languages like VBScript, Perl etc. They use few text based scripts also for automating their day to day tasks. In this case, a command base approach is more fast, reliable and painless. I said Scripting. What’s that? -> Next Slide
In simple words, Script is a small non-compiled code which generally interpreted. In fact there are lots of scripting languages available. Scripting is very much important for server admin, developers as well as testers. Few of automation tools like QTP are based on scripting languages. If you see the MS Camp, we have VBScript…… in bucket. The most important among them is VBScript. So is that Sufficient? This time “NO it depends kind answer” but a clear NO! its not sufficient. Why? Actually 3 reasons: COM Based -> and No .NET based , no object oriented (OOPS is the biggest buzz of all time in Software industry) and No further development. But still they are providing support for any bugs and security loopholes.
So obviously there was a need of a new, .NET based, object oriented scripting engine. With this basic motto, MS started developing project Monad and in Nov 2006 (Check it) they released it as Windows PowerShell. MS is recommended to migrate to PS from VBScript. An obvious quick Q? How to get Powershell? Well it’s a free download from MS and already incorporated in Windows 7 and WS08 R2. For downlevel, you need to have .NET 2.0 as a prereq. Current version of PS is 2.0. Here is a screenshot of PS window launched on Win7 machine. You will be agree that its quite similar to cmd in looks, just a reincarnation of the latter. In fact PS is backward compatible with cmd. All cmd commands will work in PS. But Few output and their formatting will be different. Like
Lets explore few basics of PS1. PowerShell -> Completely based on .NET. U can call .NET classes. Like Mathematics, String, Logic, Loops , array.In fact it’s a complete programming language and lashed with the power of .NET framework. Even its not limited to cmd, you can develop GUI apps , not complex but at least simpler apps like MTC or ART.
2. CMDLETS
3. Pipelining4. ISE
Till now whatever we discuss abt PS, you can achieve either thr’u scripting or thr’u complete languages like C#, VB or C++. So is it just another programming cum Scripting language? NO, in real world, PS is being used primarily by server admins. Also almost all the latest Microsoft server products like Exchange Server 2007, SQL 2010, Sharepoint 2010….. have in-built PS Support. They have their own set of PS cmdlets for managing them. These cmdlets are making the management part much easier, faster and reliable than GUI approach. I would like to show you one screencast, which will demonstrate one such incident. In this demo we will create a user on exchange server……..
There are various blogs and sites where you can get excellent learning materials. Few tutorials and sample scripts can be found on…