Module 1(Introduction to Powershell)
Introduction:
A shell is user interface that provides access to various services of an operating System. A
shell can be command-line based or it can include GUI.
Windows PowerShell (.ps1) is a “Shell” developed by Microsoft for purpose of performing
various user/admin tasks in windows based operating systems.
Linux Shell (.sh) is a “Shell” developed by Redhat for the same purpose
Purpose:
• Improve management and automation
• Reduce lot of human efforts and prone errors
• Manage large scale infrastructure
Pre-Requisites:
• NET Framework 4.0
• Windows Management Framework 3.0
1. Updated BITS service
2. WinRM for remoting
3. Enhanced WMI
4. Server manager CIM provider
5. PowerShell 3.0
• Double-check requirements on download page
Installing Powershell:
• Download Windows Management framework 3.0 at https://www.microsoft.com/en-
us/download/details.aspx?id=34595
• Windows XP and Server 2003 can run V2
• PowerShell V2 – Window 7 and Server 2008
• PowerShell V3 – Windows 8 and Server 2012
• PowerShell V4 – Windows 8.1 and Server 2012 R2
• PowerShell V5 – Windows 10 and upcoming versions
Apple Software Solutions Page 1
Opening Powershell:
• Start-> Run -> Powershell
• Search -> Powershell
• Start->Search-> Powershell
Opening Powershell ISE:
• Start-> Run -> Powershell ISE
• Search -> Powershell ISE
• Start->Search-> Powershell ISE
Features of Powershell ISE:
• Scripting editor
– Tab completion
– Intellisense
– Snippets
– Expandable regions
– Color coding
– Instant F1 help
– Basic debugger
•Interactive management
• console
– Tab completion
– Intellisense
– Multiple tabs
– Remoting tabs
•Integrated Show-Command
Update Help:
When you open the Powershell Console for the first time, update the help file.
Command:
Update-Help -force
Apple Software Solutions Page 2
Save Help:
We can also save help files in a folder by using following command
Save-Help folderpath
Update-Help -PSPath folderpath –requires Elevated Access
Getting familiar with Shell:
Cmdlets : Verb – Noun
Native commands work! Examples – Ping, IPConfig, calc, notepad, mspaint
cls - Clear-Host
cd - Set-Location
dir, ls - Get-Childitem
type, cat - Get-Content
Copy, cp - Copy-item
Get-Service
Get-Eventlog
Get-Process
Execution Policy:
The PowerShell execution policy prevents unintended or accidental execution of a
PowerShell scripts.
• By default, PowerShell does not run scripts.
• Get/Set-ExecutionPolicy
• Restricted
• Unrestricted
• AllSigned
• RemoteSigned
• Bypass
• Undefined
• Can be set with Group Policy
**Setting execution policy requires Elevated Access
Apple Software Solutions Page 3