Prior to Powershell VBscripts/unix scripts or DOS commands were encoded in batch files to be executed for performing repetitive task.Should there be a need to change the pattern of design the entire code would have to be re-written.This involved additional work, time and testing. Instead there was a need of a functionality wherein which you could write you own scripts give it a command name similar to that like DIR or MKDIR and have different parameter sets modifiable as per requirements.
PowerShell was invented with the idea of automating Microsoft GUI commands through a command-line interface.If you have any of the above windows version installed you will find the PowerShell under All programs -> Accessories -> Windows Powershell.
PowerShell is both a command-line shell and scripting language.
You may choose the ISE environment (x86 if your are running a 32-bit system) once you are familiar with the commands and wish to start scripting programs in PowerShell.
PowerShell has its internal variables as well just like any other shell. Get-Variable would return the list.
All the commands written for PowerShell are called CMDLETS and they have the common structure of Verb-Noun. The native Windows-DOS and Unix commands work with PowerShell. For ef - dir,cls,ps,etc. Below are a few basic commands
Anything and everything can be learnt I believe with proper use of the above CmdLets .Get-Help has a similar functionality as man command in Unix. Powershell works with all the wild card characters similar to Unix or DOS …Suppose you need to know the commands associated with process.I would type something like
Get-Command *Process
and it would return the following output depending on the version.
To know the syntax and semantics of the usage of the command one could use.
Get-help Start-process
and it would return the following output depending on the version.
As I stated earlier powershell returns object so if one wants to know what kind of object is returned and how to work further with the object you could try
Get-Process | Get-Member
and it would return the following output depending on the version.
Wondering how the native commands works simple.Type the command
Get-Alias
and you would get the below output depending on the version.
Get-verb
lists the existing verb supported by PowerShell.
I'd suggest if you really want to learn first run the command Get-Help Get-Help and browse your way through the options. If you’re a keen learner this blog will just help you take your first step to the arena of automation through PowerShell.
Microsoft Virtual Academy provides and 6 hours intensive course by expert Jeffrey Snover, the inventor of PowerShell, and Jason Helmick, Senior Technologist at Concentrated Technolog to get started with powershell.
My personal favorite are books by Don Jones. "Learn Powershell in a month of lunches" It helped me get started. I also recommend to go through the below link which provides a summary of PowerShell basics.https://technet.microsoft.com/en-us/magazine/hh551144.aspx
Powershell has the ability to work with different modules like SQL server, Active Directory, Windows Administration, IIS. Advantages and usage of Powershell are limitless for you to explore.