Powershell Help Part I (Types of Parameters)

Types of Parameters in Powershell

Powershell Help.jpg

Parameter Sets:

  1. Mandatory Parameters: If the -<parameter_name> <parameter_value> both are not enclosed in square bracket, then that parameter is called as mandatory parameter. E.g. -DisplayName <String[]>
  2. Optional Parameters: If the -<parameter_name> <parameter_value> both are enclosed in square bracket, then that parameter is called as Optional parameter. E.g. [-ComputerName <String[]>]
  3. Parameter Sets: its number of different ways the command can be executed in above example there are 3 parameter sets. Each Parameter Set will have one Unique parameter, which is not available in other 2 Parameter sets. We can not include these unique parameters together.
    • Displayname  in parameter set I
    • InputObject In parameter set II
    • Name In parameter set III. E.g. [[-Name] <String[]>]
  4. Switch Parameters: These parameter do not accept any input value, Purpose is hard coded in its name. E.g. [-DependentServices]
  5. Positional Parameters: If a -<parameter_name> only is enclosed in Square Bracket then, this parameter is called as Positional parameter. There are two types of Positions Named and Numbered
    • Named Position:If you include the parameter name for a positional parameter, the parameter can be listed in any position after the cmdlet name.
    • Numbered Position: If the “Parameter position?” setting is set to an integer other than 0,the parameter name is not required.
  6. [] : Face to face square bracket indicates that, this parameter accepts comma separated values.
    • E.g. Get-Service -Name BITS, DcomLaunch, camsvc, defragsvc

[Post-2] S/W and H/W Requirement for for Powershell

Whatever Hardware required for Installing either Server Operating system (Windows Server 2008, 2008 R2, 2012, 2012 R2 or 2016) or Client Operating System Like Windows 7, 8 and 10 that’s the only hardware dependency.

The Powershell is pre-installed on all the Server Operating system starting from Windows Server 2008, client OS Windows 7 and above. However there are stand alone downloadable are available which could be manually installed on lower versions of Operating systems (Not recommended as the support for Windows XP, Vista and Server 2003 has been stopped by Microsoft) .

The default versions of Powershell pre-Installed on respective Operating systems is as below.

PowerShell Version
Release Date
Default Windows Versions
Available Windows Versions
PowerShell 1.0
November 2006
Windows Server 2008 (*)
Windows XP SP2
Windows XP SP3
Windows Server 2003 SP1
Windows Server 2003 SP2
Windows Server 2003 R2
Windows Vista
Windows Vista SP2
PowerShell 2.0
October 2009
Windows 7
Windows Server 2008 R2 (**)
Windows XP SP3
Windows Server 2003 SP2
Windows Vista SP1
Windows Vista SP2
Windows Server 2008 SP1
Windows Server 2008 SP2
PowerShell 3.0
September 2012
Windows 8
Windows Server 2012
Windows 7 SP1
Windows Server 2008 SP2
Windows Server 2008 R2 SP1
PowerShell 4.0
October 2013
Windows 8.1
Windows Server 2012 R2
Windows 7 SP1
Windows Server 2008 R2 SP1
Windows Server 2012
PowerShell 5.0
February 2016
Windows 10
Windows 8.1
Windows Server 2012 R2
* Has to be installed through Server Manager
** Also integrated in all later Windows versions

What is Difference between various versions of Powershell?

Each Version of Powershell is backward compatible with its earlier version. Hence Cmdlets, providers, Modules, Snap-ins, Scripts, Functions and profiles that were designed in previous versions generally works with newer versions.

Windows PowerShell 3.0 includes the following new features.

  • Disconnected Sessions
  • Windows PowerShell Workflow
  • Windows PowerShell Web Access
  • Scheduled Jobs
  • Module Auto-Loading and Cmdlet Discovery Improvements
  • Get-ChildItem Attributes and Recursive Searches
  • Map Network Drives — Extend Types Without Types.ps1xml Files
  • Simplified Syntax for Where-Object and ForEach-Object
  • Updatable Help — Enhanced Online Help
  • Session Configuration Files
  • Windows PowerShell Remoting on Public Networks
  • Certificate Provider Support for Web Hosting
  • Show-Command
  •  Web Cmdlets
How to find more details about Powershell Version 3? Simply type "help about_Windows_PowerShell_3.0" on Powershell Console

Windows PowerShell 4.0 includes the following new features.

  • Windows PowerShell Desired State Configuration (DSC)
  • Save-Help now lets you save help for modules that are installed on remote computers.
  • Enhanced PowerShell debugger for Powershell Workflows
  • A RunNow parameter for Register-ScheduledJob and Set-ScheduledJob
  • Change is Default Execution Policy on 2K12 R2 (i.e. Remote Signed)
  • Method invocation by using dynamic method names is supported
  • Collection filtering by using a method syntax is now supported
  • Where() operator behavior has changed.
  • and Many More
How to find more details about Powershell Version 4? Simply type "help about_Windows_PowerShell_4.0" on Powershell Console

Windows PowerShell 5.0 includes the following new features.

  • Additional features in Desired State Configurations
  • A new module Microsoft.Powershell.Archieve
  • New Module OneGet and  PowershellGet
  • New-Item, Remove-Item, and Get-ChildItem have been enhanced to support
    creating and managing symbolic links.
  • A new detailed script tracing feature lets you enable detailed tracking and
    analysis of Windows PowerShell scripting use on a system(i.e. ETW: Event Tacing for Windows)
  • New Cryptographic Message Syntax cmdlets support encryption and decryption of content by using the IETF standard format for cryptographically protecting messages as documented by RFC5652
  • The FullyQualifiedName parameter has been added to Import-Module and
    Remove-Module cmdlets, to support storing multiple versions of a single module.
  • New Get-ItemPropertyValue cmdlet lets you get the value of a property without
    using dot notation.
  • You can now perform module version validation by running the Test-ModuleManifest cmdlet.
  • Implementation of support for multiple versions of a single Windows PowerShell module in the same folder in $PSModulePath.
How to find more details about Powershell Version 5? Simply type "help about_Windows_PowerShell_5.0" on Powershell Console

[Post-1] Why you can’t ignore learning Powershell?

I think its valuable to understand why you should consider learning Powershell, because when you do you will start realizing  the time you invest to learning Powershell will pay of huge returns. The below mentioned points will help you clear doubts about making your decision about learning Powershell.

  • It is going to become integral part of System Administration
    The mindset behind developing Powershell was to ease up the Overhead of repetitive manual works which we tend to do over a long period of time. windows system administration was considered to be GUI dominated. Where we used to navigate through the GUI and hover over Icons or Right click to get additional navigator during our activity. The GUI based administration has got zero return on investment. e.g Creating a AD user manually through GUI, if we continue with filling all the information associated with that user in that form it is expected to take approximately 3-5 minutes. But what if, we have to create 100+ users. On the contrary if you spend some time on writing automation and create users with the same details that we used to create through GUI. the same script can be repetitively used.
  • Almost all Microsoft as well as non Microsoft products are Supporting Powershell
    Virtually all of the software products Microsoft is producing right now can be managed through PowerShell, similarly other software vendors like Vmware, Citrix, various storage provider and hardware manufacturer etc are supporting the Powershell for Automation. From an administrative standpoint, this means that if you become proficient in PowerShell, you will have the skill set necessary for managing not only Microsoft but other products. The basic built-in PowerShell commands are used in every product that supports PowerShell. However, some server products extend PowerShell to include additional cmdlets.
  • You won’t be able to do everything from the GUI any more
    When Microsoft created Windows server 2012, it designed the GUI so that it could be used only for the most common administrative functions. Any obscure functions or anything potentially destructive has to be performed using PowerShell. E.g. Domain Cloning
  • It can make your life easier
    Believe it or not, using the command line can make your life easier. Suppose for a moment that you need to update an Active Directory attribute for a thousand users. Performing the task manually would likely take hours to complete. Using PowerShell, though you can complete the task using a few lines of code in matter Seconds.
  • Many GUI are PowerShell front ends
    Many of the GUI interfaces that Microsoft has been designing for its various products are actually front end interfaces to PowerShell. Probably the best known example of this is the Windows Server 2012(Active Directory). Although this utility looks like a standard management tool, it is built entirely on top of PowerShell. Any function you perform through the GUI actually generates PowerShell code that completes the requested task. In many cases, the console even shows you the PowerShell command that was used at the completion of the task.
  • Without Powershell you can’t Pass majority of  Microsoft certification Exams.
    Microsoft has been adding PowerShell specific questions to many of its new certification exams. My experience with these exams has been that you don’t necessarily have to know the full command syntax, but you do need to know which command you should be using in a given situation.
  • Microsoft says it’s important
    Just because someone at Microsoft says that something is important, that doesn’t mean I take it serious. However, In the October 2009 issue of TechNet Magazine, Microsoft says, “It’s safe to say that the single most important skill a Windows administrator will need in the coming years is proficiency with Windows PowerShell.” Such a bold statement is hard to ignore.
  • If you don’t learn it, someone else will
    As we all know, the economy is in a hunch, and many companies are downsizing. Needless to say, there is a lot of competition for the few IT jobs that are available. Therefore, if you suddenly find yourself looking for another job, your odds of finding one may be better if you can list PowerShell among your skill set.