SlideShare a Scribd company logo
www.orbitone.com
Raas van Gaverestraat 83
B-9000 GENT, Belgium
E-mail info@orbitone.com
Website www.orbitone.com
Tel. +32 9 265 74 20
Fax +32 9 265 74 10
VAT BE 456.457.353
Bank 442-7059001-50 (KBC)
17 December, 2009 Windows PowerShell 2.0, By Tom Pester
17 December, 2009
Windows PowerShell 2.0, By Tom Pester
What is PowerShell ?
17 December, 2009
Windows PowerShell 2.0, By Tom Pester
17 December, 2009
Windows PowerShell 2.0, By Tom Pester
17 December, 2009
Windows PowerShell 2.0, By Tom Pester
17 December, 2009
Windows PowerShell 2.0, By Tom Pester
Why PowerShell?
 PowerShell was designed to do for Windows what the UNIX shells dooes for UNIX:
provide a powerful, well-integrated command-line experience for the operation system.
But better :)
 Unlike most scripting languages, the basic object model for PowerShell is .NET
 PowerShell has full access to all of the types in the .NET framework and not a few simple
objects
 Windows is mostly managed through objects comming from
MI (WINDOWS MANAGEMENT INFRASTRUCTURE)
COM (COMPONENT OBJECT MODEL)
and .NET
 As Windows moves from the desktop to server farms or application servers (like print,
DNS and LDAP services,etc.) command-line automation becomes a fundamental
requirement.
17 December, 2009
Windows PowerShell 2.0, By Tom Pester
Who has PowerShell?
 Its installed out of the box on Windows 7 and Windows Server 2008 R2.
 It has also been released for older platforms:
Windows XP SP3
Windows Server 2003 SP2
Windows Vista SP1
and Windows Server 2008
17 December, 2009
Windows PowerShell 2.0, By Tom Pester
PowerShell Concepts
 - Cmdlets
These are built-in commands written in a .NET language like C# or Visual Basic.
Typically Developers can extend the set of cmdlets by writing and loading PowerShell snap-ins.
 Functions
Functions are commands written in the PowerShell language.
These can be developed without an IDE like Visual Studio by sysadmins and devs
 Scripts
Scripts are textfiles on disk with a .ps1 extension
 Applications (aka native commands)
Applications are existing windows programs.
17 December, 2009
Windows PowerShell 2.0, By Tom Pester
Providers
 Most applications have some sort of "hierarchical" data store
 Example are Exchange, Active Directory, SharePoint, SQL Server
 for example in sql server multiple instances of sql server can be installed
 Once you are in an instance you can select jobs, roles, etc or databases
 In a specific database you can choose triggers, logfiles, etc and tables
 Providers in PowerShell allow data to be presented from different data stores in a
consistent fashion to existing cmdlets.
 There are 7 providers built into PowerShell (Alias, Environment, File System, Function,
Registry, Variable, and Certificate).
17 December, 2009
Windows PowerShell 2.0, By Tom Pester
Pipeline
 UNIX scripting shells also use the concept of a pipeline.
 This is extremely powerful, but suffers from the disadvantage that, in most cases, the
pipelined data is just raw text.
 This means prayer-based parsing. Rather than passing text, PowerShell passes .NET
objects. That means a cmdlet can use .NET reflection to look inside what is getting passed,
and know what's being passed
17 December, 2009
Windows PowerShell 2.0, By Tom Pester
The pipeline
17 December, 2009
Windows PowerShell 2.0, By Tom Pester
DEMO
============================================================
==== DEMO START based on video 1 (http://www.idera.com/Promo/Practical-PowerShell/)
============================================================
*. To see everything PS can do run
> get-command
*. to get all the manuals
> help
*. get a list of all process :
> get-process
*. Piping |
Default there is "Out-Default" , per defalt it outputs everything as text
> get-process | out-default
*. Cleaning the scree
> cls
*. Lets get the top 10 memory consuming processess
> get-process | sort vm -descending | select -first 10
*. How did I know that vm was a property of a Service Object
Get-Service | get-member
* Comments in Powershell, block
<#
Now
is
the
time
to
use
PowerShell
#>
* Comments in Powershell, line
# Now
# is
# the
* Lets tweak the output
get-process | format-table name,id,responding,path
=> some columns are cut
* show help for format-table
* lets do something about the cut columns
get-process | format-table name,id,responding,path -autosize -wrap
* to learn about autosize and wrap
For more information, type:
> get-help Format-Table -detailed
* Focused help
> get-help Format-Table -examples
* lets write the report to a textfile
> Get-Process | Format-table name,id | Out-File c:temptest.txt
=> Not that we still use the pipe symbol and not > as we would do in good old dos
* Lets peek inside the event log
> Get-EventLog security -newest 50
* And take a look at it in Excel
> Get-EventLog security -newest 50 | Export-Csv c:temptest.csv
17 December, 2009
Windows PowerShell 2.0, By Tom Pester
Runspaces: Windows PowerShell hosting mechanism
 The Windows PowerShell runtime can be embedded inside other applications (jargon: in a
PowerShell "runspace").
 These applications then leverage Windows PowerShell functionality to implement certain
operations
 This capability has been utilized by Microsoft Exchange Server 2007 :
As for Exchange Server 2007, the entire server was built with Windows PowerShell in mind. In fact,
the Exchange Management Interface was designed in such a way that all the mouse-clicks and
menu-clicks are actually calls to Exchange-PowerShell cmdlets.
 This is Microsoft's direction by defining this in their common engineering criteria
 In the future all Microsoft Applications running on the Windows platform are to be
PowerShell aware.
 3th Party providers bundle PowerShell Support with their products as PS Snap-ins
17 December, 2009
Windows PowerShell 2.0, By Tom Pester
PowerShell enabled applications
17 December, 2009
Windows PowerShell 2.0, By Tom Pester
PowerShell enabled applications
Application Version Cmdlets Provider Management GUI
Exchange Server 2007 402 Yes Yes
Windows Server 2008 Yes Yes No
Microsoft SQL Server 2008 Yes Yes No
System Center Operations Manager 2007 74 Yes No
System Center Virtual Machine Manager 2007 Yes Yes Yes
System Center Data Protection Manager 2007 Yes No No
Windows Compute Cluster Server 2007 Yes Yes No
Microsoft Transporter Suite for Lotus Domino[37] 08.02.0012 47 No No
Microsoft PowerTools for Open XML[38] 1.0 33 No No
IBM WebSphere MQ[39] 6.0.2.2 44 No No
Quest Management Shell for Active Directory[40] 1.1 40 No No
Special Operations Software Specops Command[41] 1.0 Yes No Yes
VMware Infrastructure Toolkit[42] 1.5 157 No No
Internet Information Services[43] 7.0 54 Yes No
Ensim Unify Enterprise Edition[44] 1.6 Yes No Yes
Windows 7 Troubleshooting Center[45] 6.1 Yes No Yes
Microsoft Deployment Toolkit 2010 Yes No No
[edit] SnapIns and hosts
17 December, 2009
Windows PowerShell 2.0, By Tom Pester
A top overview of the features introduced in PowerShell 2
 PowerShell Remoting: Using WS-Management, PowerShell 2.0 allows scripts and cmdlets
to be invoked on a remote machine or a large set of remote machines.
 Background Jobs: Also called a PSJob, it allows a command sequence (script) or pipeline to
be invoked asynchronously. Jobs can be run on the local machine or on multiple remote
machines.
 Transactions: Enable cmdlet and provider developers to perform transacted operations.
 Script Debugging: It allows breakpoints to be set in a PowerShell script or function.
 Eventing: This feature allows listening, forwarding, and acting on management and system
events.
 Network File Transfer: Native support for prioritized, throttled, and asynchronous transfer
of files between machines using the Background Intelligent Transfer Service (BITS).
17 December, 2009
Windows PowerShell 2.0, By Tom Pester
Consistency and Discoverablity
 One of the great things of PS is the consistency and discoverablity.
 If you switch from one domain to another, lets say SQL Server to Active Directory, you can
predict what you can ask PowerShell of AD beceause you are used to SQL Server
17 December, 2009
Windows PowerShell 2.0, By Tom Pester
Save Tasks and Schedule
 A task can be saved as a script and reused at a later time or even scheduled.
For example, if you are responsible for a server park of 10 (or 1000) servers and you are interested in
the temperature you can write out the script once, save it as a script and give it a list of the servers
you are interested in.
When new servers are added you just update this list and it will give you brief report of the data you
are interested in.
IMO graphical user interfaces have their place but the power you get if you can do everying from 1
central place is not to be underestimated.
17 December, 2009
Windows PowerShell 2.0, By Tom Pester
Why PowerShell? Why not C#?
 First of all C# is not a scripting language. YOu need a compiler to make use of C#.
 If you consider a system administrator managing 10+ web servers, he/she will never install
2 gigabytes of Visual Studio on every server to edit his C# utility.
 If you have any utility that you are running on production system and want to make some
minor changes then you need to go back to your desktop where you have your source
code preferably Visual Studio installed, edit your C# program, recompile it and copy it back
to production system.
 If you really want to write actual code in C#, you need to have some knowledge of OOPs
(object oriented programming) concept (how to define class? what are static methods?)
 Even if you are writing a simple program you need to write at least main method? What
are class access rules, why to make this function public, or static etc?
17 December, 2009
Windows PowerShell 2.0, By Tom Pester
Sysadmin Challenges
 To manage a network today, Administrators face a range of challenges with respect to
tools:
Wide range: Admins are required to be experts in a huge range of tools and scripts. That’s because,
thus far, no one tool, does everything.
GUI Scalability: a GUI is a great tool for performing a single operation on just one computer, but it
can be slow and tedious if you need to perform that same operation on 1,000 systems.
17 December, 2009
Windows PowerShell 2.0, By Tom Pester
Starting up PowerShell from SQL Server 2008
This is a locked down version of PowerShell so it exposes reproducible behavior.
17 December, 2009
Windows PowerShell 2.0, By Tom Pester
* the "whatif" feature : PS> get-process p* | stop-process -
whatif
17 December, 2009
Windows PowerShell 2.0, By Tom Pester
SharePoint 2010
 STSADM is legacy, PowerShell is the replacement:
http://dmitrysotnikov.wordpress.com/2009/10/19/sharepoint-2010-cmdlet-reference/
17 December, 2009
Windows PowerShell 2.0, By Tom Pester
Recommended books & resources
 Publicly available : http://powershell.com/cs/blogs/ebook/
 Publically available : free : http://www.idera.com/Promo/Practical-PowerShell/
 Nice video on Powershell in SharePoint 2010 http://technet.microsoft.com/en-
us/sharepoint/ee518673.aspx
 MSDN http://msdn.microsoft.com/en-us/library/cc281954.aspx
 Start with http://www.amazon.com/Microsoft-PowerShell-Programming-Absolute-
Beginner/dp/1598638998/ref=sr_1_2?ie=UTF8&s=books&qid=1258411028&sr=8-2
 Become an expert with http://www.amazon.com/Windows-Powershell-Action-Bruce-
Payette/dp/1932394907/ref=sr_1_3?ie=UTF8&s=books&qid=1258411028&sr=8-3
 Microsoft SQL Server 2008 Administration with Windows PowerShell
http://www.amazon.com/Microsoft-Administration-Windows-Power-
ShellProgrammer/dp/0470477288/ref=sr_1_14?ie=UTF8&s=books&qid=1258411028&sr=8-14
 Managing VMware Infrastructure with Windows PowerShell TFM
http://www.amazon.com/Managing-VMware-Infrastructure-Windows-
PowerShell/dp/0982131402/ref=sr_1_1?ie=UTF8&s=books&qid=1258411111&sr=8-1
www.orbitone.com
Windows PowerShell 2.0, By Tom Pester
17 December, 2009

More Related Content

What's hot (20)

PPTX
PowerShell 2.0 remoting
Ravikanth Chaganti
 
PPTX
Game server development in node.js
Xie ChengChao
 
PPT
MSMDC_CLI363
mokacao
 
PPTX
Game server development in node.js in jsconf eu
Xie ChengChao
 
PDF
C++ Restrictions for Game Programming.
Richard Taylor
 
PDF
Linux Desktop Automation
Rui Lapa
 
PDF
Centralized Fog Server with OpenLDAP
tare
 
PDF
Step by step_linux_guide
vinod31dec
 
PPTX
Infrastructure as Code in your CD pipelines - London Microsoft DevOps 0423
Giulio Vian
 
PPTX
Drupal, Memcache and Solr on Windows
Alessandro Pilotti
 
DOC
Linux Shortcuts and Commands:
wensheng wei
 
PDF
Bypassing anti virus scanners
martacax
 
PPTX
Linux Based Network Proposal
Chris Riccio
 
DOCX
Linux questions
1gman68
 
PDF
Users guide
Horlarthunji Azeez
 
PDF
Ww
Sidik
 
PDF
Bewährte Praktiken für HCL Notes/Domino-Sicherheit. Teil 2: Der Domino-Server
panagenda
 
PPTX
PowerShell-2
Saravanan G
 
PDF
Handout2o
Shahbaz Sidhu
 
DOCX
Prizm Installation Guide
vjvarenya
 
PowerShell 2.0 remoting
Ravikanth Chaganti
 
Game server development in node.js
Xie ChengChao
 
MSMDC_CLI363
mokacao
 
Game server development in node.js in jsconf eu
Xie ChengChao
 
C++ Restrictions for Game Programming.
Richard Taylor
 
Linux Desktop Automation
Rui Lapa
 
Centralized Fog Server with OpenLDAP
tare
 
Step by step_linux_guide
vinod31dec
 
Infrastructure as Code in your CD pipelines - London Microsoft DevOps 0423
Giulio Vian
 
Drupal, Memcache and Solr on Windows
Alessandro Pilotti
 
Linux Shortcuts and Commands:
wensheng wei
 
Bypassing anti virus scanners
martacax
 
Linux Based Network Proposal
Chris Riccio
 
Linux questions
1gman68
 
Users guide
Horlarthunji Azeez
 
Ww
Sidik
 
Bewährte Praktiken für HCL Notes/Domino-Sicherheit. Teil 2: Der Domino-Server
panagenda
 
PowerShell-2
Saravanan G
 
Handout2o
Shahbaz Sidhu
 
Prizm Installation Guide
vjvarenya
 

Viewers also liked (20)

PPTX
Unit 8a Taxation introduction
Andrew Hingston
 
PPT
Transport Issues in Adelaide | Biocity Studio
Biocity Studio
 
PPT
Escuelas 469 Y 2098 Ciudad De Florencia
Ministerio de Educación
 
PPTX
Unit 3e Final tips
Andrew Hingston
 
PPTX
Unit 18c Retirement dwellings
Andrew Hingston
 
PDF
Artikel I Maintain Juni 2011
AlexSport
 
PPTX
Trend: Customized
Nisha Gill
 
PPTX
Academic Impropriety Vs academic impoverishment
Orna Farrell
 
PPTX
Unit 4b Creative ways to own a home
Andrew Hingston
 
PDF
Altunizade Kültür Merkezi 18 Nisan 2014 Müzikli Maarif Takvimi gecesi
aokutur
 
PDF
Bahcelievler kültür merkezi 12 _04_2014 resimler
aokutur
 
PPT
Reprioritising our values to recognise culture for its true value | Biocity S...
Biocity Studio
 
PPSX
Carioc Studio
Wassil Sarall
 
PPT
Navat Company
beerguy
 
PPSX
Halle Berry
Wassil Sarall
 
PDF
The Importance of Social and Mobile in Year-End Campaigns
Charity Dynamics
 
PDF
Participant Support Webinar
Charity Dynamics
 
PDF
NB - дайджест новостей
Ingria. Technopark St. Petersburg
 
PDF
Кризис роста в ИТ-компании Иоря Ашманова
Ingria. Technopark St. Petersburg
 
PPTX
The elephant
The Lower School
 
Unit 8a Taxation introduction
Andrew Hingston
 
Transport Issues in Adelaide | Biocity Studio
Biocity Studio
 
Escuelas 469 Y 2098 Ciudad De Florencia
Ministerio de Educación
 
Unit 3e Final tips
Andrew Hingston
 
Unit 18c Retirement dwellings
Andrew Hingston
 
Artikel I Maintain Juni 2011
AlexSport
 
Trend: Customized
Nisha Gill
 
Academic Impropriety Vs academic impoverishment
Orna Farrell
 
Unit 4b Creative ways to own a home
Andrew Hingston
 
Altunizade Kültür Merkezi 18 Nisan 2014 Müzikli Maarif Takvimi gecesi
aokutur
 
Bahcelievler kültür merkezi 12 _04_2014 resimler
aokutur
 
Reprioritising our values to recognise culture for its true value | Biocity S...
Biocity Studio
 
Carioc Studio
Wassil Sarall
 
Navat Company
beerguy
 
Halle Berry
Wassil Sarall
 
The Importance of Social and Mobile in Year-End Campaigns
Charity Dynamics
 
Participant Support Webinar
Charity Dynamics
 
NB - дайджест новостей
Ingria. Technopark St. Petersburg
 
Кризис роста в ИТ-компании Иоря Ашманова
Ingria. Technopark St. Petersburg
 
The elephant
The Lower School
 
Ad

Similar to Windows PowerShell (20)

PPT
Powershell Seminar @ ITWorx CuttingEdge Club
Essam Salah
 
PDF
Sql Server & PowerShell
Aaron Shilo
 
PDF
Activity 5
Heidi Owens
 
PPT
PowerShell Technical Overview
allandcp
 
PPTX
Wsv406 Advanced Automation Using Windows Power Shell2.0
jsnover1
 
PPT
Server Core2
Concentrated Technology
 
PDF
PowerShell for SharePoint Developers
Boulos Dib
 
PPT
No-script PowerShell v2
Concentrated Technology
 
PPTX
Brian Jackett: Managing SharePoint 2010 Farms with Powershell
SharePoint Saturday NY
 
PPTX
Brian Jackett: Managing SharePoint 2010 Farms with Powershell
SharePoint Saturday NY
 
PPTX
Windows Server 2008 Management
Hi-Techpoint
 
PPTX
Windows Server 2008 Management
Hi-Techpoint
 
PPTX
Power shell training
David Brabant
 
PPTX
PowerShell-1
Saravanan G
 
PPTX
Inventory your network and clients with PowerShell
Concentrated Technology
 
PPT
Windows_Server_2008_Management & Ack.ppt
zongopaul372
 
PPTX
Introducing PowerShell 3.0
Jan Egil Ring
 
PPTX
Automating Desktop Management with Windows Powershell V2.0 and Group Policy M...
Microsoft TechNet
 
PPT
PowerShell Remoting
Concentrated Technology
 
PDF
Learn Powershell Scripting Tutorial Full Course 1dollarcart.com.pdf
ClapperboardCinemaPV
 
Powershell Seminar @ ITWorx CuttingEdge Club
Essam Salah
 
Sql Server & PowerShell
Aaron Shilo
 
Activity 5
Heidi Owens
 
PowerShell Technical Overview
allandcp
 
Wsv406 Advanced Automation Using Windows Power Shell2.0
jsnover1
 
PowerShell for SharePoint Developers
Boulos Dib
 
No-script PowerShell v2
Concentrated Technology
 
Brian Jackett: Managing SharePoint 2010 Farms with Powershell
SharePoint Saturday NY
 
Brian Jackett: Managing SharePoint 2010 Farms with Powershell
SharePoint Saturday NY
 
Windows Server 2008 Management
Hi-Techpoint
 
Windows Server 2008 Management
Hi-Techpoint
 
Power shell training
David Brabant
 
PowerShell-1
Saravanan G
 
Inventory your network and clients with PowerShell
Concentrated Technology
 
Windows_Server_2008_Management & Ack.ppt
zongopaul372
 
Introducing PowerShell 3.0
Jan Egil Ring
 
Automating Desktop Management with Windows Powershell V2.0 and Group Policy M...
Microsoft TechNet
 
PowerShell Remoting
Concentrated Technology
 
Learn Powershell Scripting Tutorial Full Course 1dollarcart.com.pdf
ClapperboardCinemaPV
 
Ad

More from Orbit One - We create coherence (20)

PPTX
ShareCafé: SharePoint - Een doos vol documenten of dé tool om efficiënt samen...
Orbit One - We create coherence
 
PPTX
HoGent tips and tricks van een self-made ondernemer
Orbit One - We create coherence
 
PPTX
Het Nieuwe Werken in de praktijk
Orbit One - We create coherence
 
PPTX
ShareCafé: Office365 - Efficiënt samenwerken met minimum aan kosten en comple...
Orbit One - We create coherence
 
PPTX
ShareCafé 3 - Geef je samenwerking een technologische upgrade
Orbit One - We create coherence
 
PPTX
ShareCafé 2 - Werk slimmer door geïntegreerde tools
Orbit One - We create coherence
 
PPTX
ShareCafé 1: Hou de Nieuwe Werker gemotiveerd
Orbit One - We create coherence
 
PPTX
Business value of Lync integrations
Orbit One - We create coherence
 
PPTX
OneCafé: De toekomst van ledenorganisaties met behulp van CRM en informatie-u...
Orbit One - We create coherence
 
PPTX
Identity in the cloud using Microsoft
Orbit One - We create coherence
 
PPTX
OneCafé: The future of membership organizations facilitated by CRM and collab...
Orbit One - We create coherence
 
PPTX
OneCafé: The new world of work and your organisation
Orbit One - We create coherence
 
PPTX
Social Computing in your organization using SharePoint: challenges and benefits
Orbit One - We create coherence
 
PPTX
Windows Communication Foundation (WCF) Best Practices
Orbit One - We create coherence
 
PPTX
Wie is Orbit One Internet Solutions
Orbit One - We create coherence
 
PPTX
Azure Umbraco workshop
Orbit One - We create coherence
 
PPTX
Marketing Automation in Dynamics CRM with ClickDimensions
Orbit One - We create coherence
 
PPTX
Office 365, is cloud right for your company?
Orbit One - We create coherence
 
PPTX
Who is Orbit One internet solutions?
Orbit One - We create coherence
 
PPTX
Azure and Umbraco CMS
Orbit One - We create coherence
 
ShareCafé: SharePoint - Een doos vol documenten of dé tool om efficiënt samen...
Orbit One - We create coherence
 
HoGent tips and tricks van een self-made ondernemer
Orbit One - We create coherence
 
Het Nieuwe Werken in de praktijk
Orbit One - We create coherence
 
ShareCafé: Office365 - Efficiënt samenwerken met minimum aan kosten en comple...
Orbit One - We create coherence
 
ShareCafé 3 - Geef je samenwerking een technologische upgrade
Orbit One - We create coherence
 
ShareCafé 2 - Werk slimmer door geïntegreerde tools
Orbit One - We create coherence
 
ShareCafé 1: Hou de Nieuwe Werker gemotiveerd
Orbit One - We create coherence
 
Business value of Lync integrations
Orbit One - We create coherence
 
OneCafé: De toekomst van ledenorganisaties met behulp van CRM en informatie-u...
Orbit One - We create coherence
 
Identity in the cloud using Microsoft
Orbit One - We create coherence
 
OneCafé: The future of membership organizations facilitated by CRM and collab...
Orbit One - We create coherence
 
OneCafé: The new world of work and your organisation
Orbit One - We create coherence
 
Social Computing in your organization using SharePoint: challenges and benefits
Orbit One - We create coherence
 
Windows Communication Foundation (WCF) Best Practices
Orbit One - We create coherence
 
Wie is Orbit One Internet Solutions
Orbit One - We create coherence
 
Azure Umbraco workshop
Orbit One - We create coherence
 
Marketing Automation in Dynamics CRM with ClickDimensions
Orbit One - We create coherence
 
Office 365, is cloud right for your company?
Orbit One - We create coherence
 
Who is Orbit One internet solutions?
Orbit One - We create coherence
 
Azure and Umbraco CMS
Orbit One - We create coherence
 

Recently uploaded (20)

PDF
From Chatbot to Destroyer of Endpoints - Can ChatGPT Automate EDR Bypasses (1...
Priyanka Aash
 
PDF
The Future of Product Management in AI ERA.pdf
Alyona Owens
 
PDF
Kubernetes - Architecture & Components.pdf
geethak285
 
PPTX
Curietech AI in action - Accelerate MuleSoft development
shyamraj55
 
PPTX
Smarter Governance with AI: What Every Board Needs to Know
OnBoard
 
PDF
Plugging AI into everything: Model Context Protocol Simplified.pdf
Abati Adewale
 
PDF
Python Conference Singapore - 19 Jun 2025
ninefyi
 
PDF
Unlocking FME Flow’s Potential: Architecture Design for Modern Enterprises
Safe Software
 
PDF
“MPU+: A Transformative Solution for Next-Gen AI at the Edge,” a Presentation...
Edge AI and Vision Alliance
 
PPTX
01_Approach Cyber- DORA Incident Management.pptx
FinTech Belgium
 
PDF
5 Things to Consider When Deploying AI in Your Enterprise
Safe Software
 
PPTX
UserCon Belgium: Honey, VMware increased my bill
stijn40
 
PDF
UiPath Agentic AI ile Akıllı Otomasyonun Yeni Çağı
UiPathCommunity
 
PPTX
Enabling the Digital Artisan – keynote at ICOCI 2025
Alan Dix
 
DOCX
Daily Lesson Log MATATAG ICT TEchnology 8
LOIDAALMAZAN3
 
PPTX
Practical Applications of AI in Local Government
OnBoard
 
PDF
Database Benchmarking for Performance Masterclass: Session 2 - Data Modeling ...
ScyllaDB
 
PPTX
𝙳𝚘𝚠𝚗𝚕𝚘𝚊𝚍—Wondershare Filmora Crack 14.0.7 + Key Download 2025
sebastian aliya
 
PDF
Cracking the Code - Unveiling Synergies Between Open Source Security and AI.pdf
Priyanka Aash
 
PDF
How to Visualize the ​Spatio-Temporal Data Using CesiumJS​
SANGHEE SHIN
 
From Chatbot to Destroyer of Endpoints - Can ChatGPT Automate EDR Bypasses (1...
Priyanka Aash
 
The Future of Product Management in AI ERA.pdf
Alyona Owens
 
Kubernetes - Architecture & Components.pdf
geethak285
 
Curietech AI in action - Accelerate MuleSoft development
shyamraj55
 
Smarter Governance with AI: What Every Board Needs to Know
OnBoard
 
Plugging AI into everything: Model Context Protocol Simplified.pdf
Abati Adewale
 
Python Conference Singapore - 19 Jun 2025
ninefyi
 
Unlocking FME Flow’s Potential: Architecture Design for Modern Enterprises
Safe Software
 
“MPU+: A Transformative Solution for Next-Gen AI at the Edge,” a Presentation...
Edge AI and Vision Alliance
 
01_Approach Cyber- DORA Incident Management.pptx
FinTech Belgium
 
5 Things to Consider When Deploying AI in Your Enterprise
Safe Software
 
UserCon Belgium: Honey, VMware increased my bill
stijn40
 
UiPath Agentic AI ile Akıllı Otomasyonun Yeni Çağı
UiPathCommunity
 
Enabling the Digital Artisan – keynote at ICOCI 2025
Alan Dix
 
Daily Lesson Log MATATAG ICT TEchnology 8
LOIDAALMAZAN3
 
Practical Applications of AI in Local Government
OnBoard
 
Database Benchmarking for Performance Masterclass: Session 2 - Data Modeling ...
ScyllaDB
 
𝙳𝚘𝚠𝚗𝚕𝚘𝚊𝚍—Wondershare Filmora Crack 14.0.7 + Key Download 2025
sebastian aliya
 
Cracking the Code - Unveiling Synergies Between Open Source Security and AI.pdf
Priyanka Aash
 
How to Visualize the ​Spatio-Temporal Data Using CesiumJS​
SANGHEE SHIN
 

Windows PowerShell

  • 1. www.orbitone.com Raas van Gaverestraat 83 B-9000 GENT, Belgium E-mail [email protected] Website www.orbitone.com Tel. +32 9 265 74 20 Fax +32 9 265 74 10 VAT BE 456.457.353 Bank 442-7059001-50 (KBC) 17 December, 2009 Windows PowerShell 2.0, By Tom Pester
  • 2. 17 December, 2009 Windows PowerShell 2.0, By Tom Pester What is PowerShell ?
  • 3. 17 December, 2009 Windows PowerShell 2.0, By Tom Pester
  • 4. 17 December, 2009 Windows PowerShell 2.0, By Tom Pester
  • 5. 17 December, 2009 Windows PowerShell 2.0, By Tom Pester
  • 6. 17 December, 2009 Windows PowerShell 2.0, By Tom Pester Why PowerShell?  PowerShell was designed to do for Windows what the UNIX shells dooes for UNIX: provide a powerful, well-integrated command-line experience for the operation system. But better :)  Unlike most scripting languages, the basic object model for PowerShell is .NET  PowerShell has full access to all of the types in the .NET framework and not a few simple objects  Windows is mostly managed through objects comming from MI (WINDOWS MANAGEMENT INFRASTRUCTURE) COM (COMPONENT OBJECT MODEL) and .NET  As Windows moves from the desktop to server farms or application servers (like print, DNS and LDAP services,etc.) command-line automation becomes a fundamental requirement.
  • 7. 17 December, 2009 Windows PowerShell 2.0, By Tom Pester Who has PowerShell?  Its installed out of the box on Windows 7 and Windows Server 2008 R2.  It has also been released for older platforms: Windows XP SP3 Windows Server 2003 SP2 Windows Vista SP1 and Windows Server 2008
  • 8. 17 December, 2009 Windows PowerShell 2.0, By Tom Pester PowerShell Concepts  - Cmdlets These are built-in commands written in a .NET language like C# or Visual Basic. Typically Developers can extend the set of cmdlets by writing and loading PowerShell snap-ins.  Functions Functions are commands written in the PowerShell language. These can be developed without an IDE like Visual Studio by sysadmins and devs  Scripts Scripts are textfiles on disk with a .ps1 extension  Applications (aka native commands) Applications are existing windows programs.
  • 9. 17 December, 2009 Windows PowerShell 2.0, By Tom Pester Providers  Most applications have some sort of "hierarchical" data store  Example are Exchange, Active Directory, SharePoint, SQL Server  for example in sql server multiple instances of sql server can be installed  Once you are in an instance you can select jobs, roles, etc or databases  In a specific database you can choose triggers, logfiles, etc and tables  Providers in PowerShell allow data to be presented from different data stores in a consistent fashion to existing cmdlets.  There are 7 providers built into PowerShell (Alias, Environment, File System, Function, Registry, Variable, and Certificate).
  • 10. 17 December, 2009 Windows PowerShell 2.0, By Tom Pester Pipeline  UNIX scripting shells also use the concept of a pipeline.  This is extremely powerful, but suffers from the disadvantage that, in most cases, the pipelined data is just raw text.  This means prayer-based parsing. Rather than passing text, PowerShell passes .NET objects. That means a cmdlet can use .NET reflection to look inside what is getting passed, and know what's being passed
  • 11. 17 December, 2009 Windows PowerShell 2.0, By Tom Pester The pipeline
  • 12. 17 December, 2009 Windows PowerShell 2.0, By Tom Pester DEMO ============================================================ ==== DEMO START based on video 1 (http://www.idera.com/Promo/Practical-PowerShell/) ============================================================ *. To see everything PS can do run > get-command *. to get all the manuals > help *. get a list of all process : > get-process *. Piping | Default there is "Out-Default" , per defalt it outputs everything as text > get-process | out-default *. Cleaning the scree > cls *. Lets get the top 10 memory consuming processess > get-process | sort vm -descending | select -first 10 *. How did I know that vm was a property of a Service Object Get-Service | get-member * Comments in Powershell, block <# Now is the time to use PowerShell #> * Comments in Powershell, line # Now # is # the * Lets tweak the output get-process | format-table name,id,responding,path => some columns are cut * show help for format-table * lets do something about the cut columns get-process | format-table name,id,responding,path -autosize -wrap * to learn about autosize and wrap For more information, type: > get-help Format-Table -detailed * Focused help > get-help Format-Table -examples * lets write the report to a textfile > Get-Process | Format-table name,id | Out-File c:temptest.txt => Not that we still use the pipe symbol and not > as we would do in good old dos * Lets peek inside the event log > Get-EventLog security -newest 50 * And take a look at it in Excel > Get-EventLog security -newest 50 | Export-Csv c:temptest.csv
  • 13. 17 December, 2009 Windows PowerShell 2.0, By Tom Pester Runspaces: Windows PowerShell hosting mechanism  The Windows PowerShell runtime can be embedded inside other applications (jargon: in a PowerShell "runspace").  These applications then leverage Windows PowerShell functionality to implement certain operations  This capability has been utilized by Microsoft Exchange Server 2007 : As for Exchange Server 2007, the entire server was built with Windows PowerShell in mind. In fact, the Exchange Management Interface was designed in such a way that all the mouse-clicks and menu-clicks are actually calls to Exchange-PowerShell cmdlets.  This is Microsoft's direction by defining this in their common engineering criteria  In the future all Microsoft Applications running on the Windows platform are to be PowerShell aware.  3th Party providers bundle PowerShell Support with their products as PS Snap-ins
  • 14. 17 December, 2009 Windows PowerShell 2.0, By Tom Pester PowerShell enabled applications
  • 15. 17 December, 2009 Windows PowerShell 2.0, By Tom Pester PowerShell enabled applications Application Version Cmdlets Provider Management GUI Exchange Server 2007 402 Yes Yes Windows Server 2008 Yes Yes No Microsoft SQL Server 2008 Yes Yes No System Center Operations Manager 2007 74 Yes No System Center Virtual Machine Manager 2007 Yes Yes Yes System Center Data Protection Manager 2007 Yes No No Windows Compute Cluster Server 2007 Yes Yes No Microsoft Transporter Suite for Lotus Domino[37] 08.02.0012 47 No No Microsoft PowerTools for Open XML[38] 1.0 33 No No IBM WebSphere MQ[39] 6.0.2.2 44 No No Quest Management Shell for Active Directory[40] 1.1 40 No No Special Operations Software Specops Command[41] 1.0 Yes No Yes VMware Infrastructure Toolkit[42] 1.5 157 No No Internet Information Services[43] 7.0 54 Yes No Ensim Unify Enterprise Edition[44] 1.6 Yes No Yes Windows 7 Troubleshooting Center[45] 6.1 Yes No Yes Microsoft Deployment Toolkit 2010 Yes No No [edit] SnapIns and hosts
  • 16. 17 December, 2009 Windows PowerShell 2.0, By Tom Pester A top overview of the features introduced in PowerShell 2  PowerShell Remoting: Using WS-Management, PowerShell 2.0 allows scripts and cmdlets to be invoked on a remote machine or a large set of remote machines.  Background Jobs: Also called a PSJob, it allows a command sequence (script) or pipeline to be invoked asynchronously. Jobs can be run on the local machine or on multiple remote machines.  Transactions: Enable cmdlet and provider developers to perform transacted operations.  Script Debugging: It allows breakpoints to be set in a PowerShell script or function.  Eventing: This feature allows listening, forwarding, and acting on management and system events.  Network File Transfer: Native support for prioritized, throttled, and asynchronous transfer of files between machines using the Background Intelligent Transfer Service (BITS).
  • 17. 17 December, 2009 Windows PowerShell 2.0, By Tom Pester Consistency and Discoverablity  One of the great things of PS is the consistency and discoverablity.  If you switch from one domain to another, lets say SQL Server to Active Directory, you can predict what you can ask PowerShell of AD beceause you are used to SQL Server
  • 18. 17 December, 2009 Windows PowerShell 2.0, By Tom Pester Save Tasks and Schedule  A task can be saved as a script and reused at a later time or even scheduled. For example, if you are responsible for a server park of 10 (or 1000) servers and you are interested in the temperature you can write out the script once, save it as a script and give it a list of the servers you are interested in. When new servers are added you just update this list and it will give you brief report of the data you are interested in. IMO graphical user interfaces have their place but the power you get if you can do everying from 1 central place is not to be underestimated.
  • 19. 17 December, 2009 Windows PowerShell 2.0, By Tom Pester Why PowerShell? Why not C#?  First of all C# is not a scripting language. YOu need a compiler to make use of C#.  If you consider a system administrator managing 10+ web servers, he/she will never install 2 gigabytes of Visual Studio on every server to edit his C# utility.  If you have any utility that you are running on production system and want to make some minor changes then you need to go back to your desktop where you have your source code preferably Visual Studio installed, edit your C# program, recompile it and copy it back to production system.  If you really want to write actual code in C#, you need to have some knowledge of OOPs (object oriented programming) concept (how to define class? what are static methods?)  Even if you are writing a simple program you need to write at least main method? What are class access rules, why to make this function public, or static etc?
  • 20. 17 December, 2009 Windows PowerShell 2.0, By Tom Pester Sysadmin Challenges  To manage a network today, Administrators face a range of challenges with respect to tools: Wide range: Admins are required to be experts in a huge range of tools and scripts. That’s because, thus far, no one tool, does everything. GUI Scalability: a GUI is a great tool for performing a single operation on just one computer, but it can be slow and tedious if you need to perform that same operation on 1,000 systems.
  • 21. 17 December, 2009 Windows PowerShell 2.0, By Tom Pester Starting up PowerShell from SQL Server 2008 This is a locked down version of PowerShell so it exposes reproducible behavior.
  • 22. 17 December, 2009 Windows PowerShell 2.0, By Tom Pester * the "whatif" feature : PS> get-process p* | stop-process - whatif
  • 23. 17 December, 2009 Windows PowerShell 2.0, By Tom Pester SharePoint 2010  STSADM is legacy, PowerShell is the replacement: http://dmitrysotnikov.wordpress.com/2009/10/19/sharepoint-2010-cmdlet-reference/
  • 24. 17 December, 2009 Windows PowerShell 2.0, By Tom Pester Recommended books & resources  Publicly available : http://powershell.com/cs/blogs/ebook/  Publically available : free : http://www.idera.com/Promo/Practical-PowerShell/  Nice video on Powershell in SharePoint 2010 http://technet.microsoft.com/en- us/sharepoint/ee518673.aspx  MSDN http://msdn.microsoft.com/en-us/library/cc281954.aspx  Start with http://www.amazon.com/Microsoft-PowerShell-Programming-Absolute- Beginner/dp/1598638998/ref=sr_1_2?ie=UTF8&s=books&qid=1258411028&sr=8-2  Become an expert with http://www.amazon.com/Windows-Powershell-Action-Bruce- Payette/dp/1932394907/ref=sr_1_3?ie=UTF8&s=books&qid=1258411028&sr=8-3  Microsoft SQL Server 2008 Administration with Windows PowerShell http://www.amazon.com/Microsoft-Administration-Windows-Power- ShellProgrammer/dp/0470477288/ref=sr_1_14?ie=UTF8&s=books&qid=1258411028&sr=8-14  Managing VMware Infrastructure with Windows PowerShell TFM http://www.amazon.com/Managing-VMware-Infrastructure-Windows- PowerShell/dp/0982131402/ref=sr_1_1?ie=UTF8&s=books&qid=1258411111&sr=8-1
  • 25. www.orbitone.com Windows PowerShell 2.0, By Tom Pester 17 December, 2009