Power shell a quick introduction
I got an opportunity to check poweshell concepts today, related to a project of integrating ITglue APIs and Powershell commands. I was 100% new to powershell and was not sure about what this term means actually.
I realised a few things after I checked it. We have to have 2 points in our mind before start. Then it will make your powershell journey a bit more easier.
Powershell is used in Windows operating systems We can say powershell is an advanced version of Command prompt in windows. Now its a bit easy right ?
Features of Powershell
PowerShell Remoting: PowerShell allows scripts and cmdlets to be invoked on a remote machine.
Background Jobs: It helps you to invoked script or pipeline asynchronously. You can run your jobs either on the local machine or multiple remotely operated machines.
Transactions: Enable cmdlet and allows developers to perform
Evening: This command helps you to listen, forwarding, and acting on management and system events.
Network File Transfer: Powershell offers native support for prioritized, asynchronous, throttled, transfer of files between machines using the Background Intelligent Transfer Service (BITS) technology.
Cmdlet vs. Command:
Cmdlets are different from commands in other command-shell environments in the following manners −
Cmdlets are .NET Framework class objects It can't be executed separately
Cmdlets can construct from as few as a dozen lines of code
Parsing, output formatting, and error presentation are not handled by cmdlets
Cmdlets process works on objects. So text stream and objects can't be passed as output for pipelining
Cmdlets are record-based as so it processes a single object at a time.
Most of the PowerShell functionality comes from Cmdlet's which is always in verb-noun format and not plural. Moreover, Cmdlet's return objects not text. A cmdlet is a series of commands, which is more than one line, stored in a text file with a .ps1 extension.
A cmdlet always consists of a verb and a noun, separated with a hyphen. Some of the verbs use for you to learn PowerShell is:
Get — To get something Start — To run something Out — To output something Stop — To stop something that is running Set — To define something New — To create something
Moreover, there is a policy which restricts script execution. You can see this policy by running the Get-ExecutionPolicy command.
You will get one of the following output:
Restricted— No scripts are allowed. This is the default setting, so it will display first time when you run the command.
AllSigned— You can run scripts signed by a trusted developer. With the help of this setting, a script will ask for confirmation that you want to run it before executing.
RemoteSigned— You can run your or scripts signed by a trusted developer.
Unrestricted— You can run any script which you wants to run