What is PowerShell
The logical evolution of the popular Windows command prompt (cmd.exe) is Windows PowerShell. It has new capabilities and features such as the use of interactive commands and Unix-style command base “cmdlets”. It is a powerful utility for Windows system administrators and interacts with SQL Server, Exchange or IIS. Another is to allow capabilities automate tasks and script execution with the *. Ps1, PowerShell only recognizes this extension to run any program script.
Below is a short list of common commands Cmd.exe and UNIX you can also use in Windows PowerShell:
cat | dir | mount | rm | clear | h | ps | sort |
cd | echo | move | rmdir | cls | history | pushd | tee |
chdir | erase | popd | sleep | copy | kill | pwd | Type |
copy | kill | pwd | type | del | lp | r | Write |
PowerShell Features:
Here are some basic features of PowerShell over the command prompt:
- An important feature of the PowerShell is this (tab-completion). This allows us to introduce a partial command and press the “Tab” to PowerShell try to complete the rest of the command.
- You can run different types of scripts and scripts file from PowerShell.<link to example>
- You can get the help about all commands of Powershell in PowerShell for example you don’t know how to use “Get-service” command you simply type get-help get-service and PowerShell will show you all info regarding get-service command. Also type the get-command to get all the cmdlets.
- We have command history feature in PowerShell, we can press the “up arrow “to show us the command you just entered. You can also check what you do, just enter “get-history “on the command line of Powershell .
FormatSyntax of the commands in Powershell:
In any shell that we can find, the commands have a specific format so they can be interpreted correctly. As I said in the previous article, the commands in Powershell called “camlets “(command lets).
Normally a commandlet consists three parts.
- A verb.
- A name.
- One or more parameters (optional).
The verb and name are separated by the character ”dash” (-) and the parameters and arguments by the character “space” could be more or less like this:
Verb-noun-parameter1-parameter2 argument1 argument2
Examples:
Get-history-count 10
User account in Active Directory | Create Users Account in AD Using PowerShell