Introduction to powershell


Published on

Gave this presentation in May, 2010 at Wipro internal KM sessions. Was going through my blog and found this @ :)

Published in: Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • 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…
  • Get Ready!!!
  • Thanks
  • Introduction to powershell

    1. 1. PowerShell Reincarnation of command prompt Ankit Kashyap © 2009 Wipro Ltd - Confidential
    2. 2. Before We Begin How Many of you have seen the blockbuster “Karan-Arjun”? How many of you believe in „Reincarnation‟? TP 49 TP 50 The Very basic difference between Unix and Windows… 91% Market Share 2 © 2009 Wipro Ltd - Confidential
    3. 3. GUI Rocks, Command Line is hell! Why GUI Rocks?  Easy Navigation  Simpler depiction of System data, files, folders  No need to memorize lengthy commands and their bunch of parameters  No significant competency required, even a layman can work on it. So is it a panacea? 3 © 2009 Wipro Ltd - Confidential
    4. 4. GUI ≠ Panacea for all My Bro IT Admin @ Wipro “Mixed Approach” Scripts make Life Easier! Wanna Just GUI!! 4 © 2009 Wipro Ltd - Confidential
    5. 5. Scripting Not this Script JScrip t Perl Shell PHP VBScript Awk Sid JavaScrip t TCL -TK Is VBScript OK?  Its COM based but softwares are .NET based  No OOPS!!  MS Stopped its further development – No new releases!! We need a new language!! 5 © 2009 Wipro Ltd - Confidential
    6. 6. Need of the hour: PowerShell World needs a brand new scripting language: .NET based OOPS Enabled Simple to learn Complete language “Windows PowerShell is Exactly what we are looking for!” • Already in-built in Windows 7 & Server 2K8 (its R2) • • PreReq for Downlevel OS: .NET 2.0 SP1 • 6 Free download for XP, Vista and WS03 Current Version: 2.0 © 2009 Wipro Ltd - Confidential
    7. 7. PowerShell: Basics for Dummies PowerShell Completely Based on .NET What it means??  Based on .NET framework  You can use a major portion of .NET framework in PS.  Not limited to cmd, even you can develop a GUI based program too!!  Backward compatible with old cmd (Reincarnation??) 7 © 2009 Wipro Ltd - Confidential
    8. 8. PowerShell: Basics for Dummies Don‟t call Commands, Call them cmdlets Set-date They are not .exe or .com based binaries, they are .NET classes!! 8 © 2009 Wipro Ltd - Confidential They have unique naming convention in verb-noun format! Easy to remember
    9. 9. PowerShell: Basics for Dummies Supports Pipelining Support Remote Execution dir c: | find “.exe” Has a Good GUI-Editor PowerShell ISE Support a command line based Intelli-sense just like Visual Studio All the main programming features like Array, files, loops , logic operator etc 9 © 2009 Wipro Ltd - Confidential
    10. 10. PowerShell: Is it just another Scripting language Just like traditional scripting languages, it does the basic scripting tasks So is it just another Language??  Almost every latest version of server apps like Exchange server, SQL server, SharePoint have PS based management environment  Even 3rd party apps now a days are having their own PS cmdlets!!  It‟s the future language for Server Admins & Power Users.  In the future, PowerShell become OmniPresent 10 © 2009 Wipro Ltd - Confidential
    11. 11. More about PowerShell • Microsoft Learning portal • PowerShell Script Center • PowerShell Community 12 © 2009 Wipro Ltd - Confidential
    12. 12. Queries tweet me : @ankitwww 13 © 2009 Wipro Ltd - Confidential
    13. 13. Thanks Closing Line: PowerShell = emPOWERing the old cmd SHELL with the help of .NET for mainly Server Professionals © 2009 Wipro Ltd - Confidential