What is PowerShell?
PowerShell is Microsoft new Command Line Interface for Windows systems, it provides access to:
- Existing Windows Command Line tools.
- PowerShell Cmdlets (PowerShell own Commands)
- PowerShell Functions
- Access to the .Net Framework API
- Access to WMI (Windows Management Instrumentation
- Access to Windows COM (Component Object Model)
- Access to function in Windows DLL (Dynamic Linked Libraries)
- Access to different third party APIs like VMWare, Citrix, Microsoft Exchange, Office 365 and many more.
Checking the PowerShell Version:
Just open the Powershell console and type Get-Host or $PSVersionTable This will display the PowerShell version installed on the system.
Getting Help in PowerShell: We have built in help in PowerShell. We also can update help using PowerShell commands.
Just type Get-Help in the console.
Press Y to update.
The Get-Help cmdlet displays help at the command line from content in help files on your computer. Without help files, Get-Help displays basic help about cmdlets and functions. You can also use Get-Help to display online help for cmdlets and functions.
To get help for a cmdlet, type: Get-Help
To download and install help files on your computer:
* Start Windows PowerShell with the “Run as administrator” option.
* Type: Update-Help
After the help files are installed, you can use the Get-Help cmdlet to display the help topics. You can also use the Update-Help cmdlet to download updated help files so that your local help files are always up-to-date.
You can find help for Windows PowerShell online in the TechNet Library beginning at http://go.microsoft.com/fwlink/?LinkID=108518.
To open online help for any cmdlet or function, type: Get-Help -Online
Running PowerShell Commands:
To get the list of commands, type Get-Command ↵
Get-Alias command will display all the cmdlet aliases. Get-Alias will display the cmdlet Name.
PS C:\> Get-Alias gwmi CommandType Name Version Source ----------- ---- ------- ------ Alias gwmi -> Get-WmiObject PS C:\> Get-Alias dir CommandType Name Version Source ----------- ---- ------- ------ Alias dir -> Get-ChildItem
Configuring PowerShell Console:
We can configure PowerShell console as we may want. Changing the colors, changing back ground color, font and other settings. There are many ways of doing this.
One is a graphical way: Just right click on title bar and a settings window will be opened.
Just navigate to different tabs and change the settings as required.
Other way is through PowerShell commands.
Here are some examples:
$console = $host.UI.RawUI
$console.ForegroundColor = “black”
$console.BackgroundColor = “white”