SlideShare une entreprise Scribd logo
1  sur  53
{ PowerShell Scripting
Uygulamaları}
Mesut ALADAĞ
Teknoloji Direktörü / MCT
mesutaladag@mayasoft.com.tr
Sunumumuz 15:00’da başlayacaktır…
Ajanda
• PowerShell Nedir?
• PowerShell Kurulumu
• PowerShell Giriş ve Özellikler
• Temel Komutlar
• Değişken ve Operatör Kullanımı
• Döngüler ve Akış Kontrol Deyimleri
• Genel Uygulamalar
• PowerShell’in Geleceği
PowerShell Nedir?
• Before you install Windows PowerShell, be sure that
your system has the software programs that
Windows PowerShell requires. Windows PowerShell
requires the following programs:
• Windows XP Service Pack 2, Windows 2003 Service Pack
1, or later versions of Windows
• Microsoft .NET Framework 2.0
• If any version of Windows PowerShell is already
installed on the computer, use Add or Remove
Programs in Control Panel to uninstall it before
installing a new version.
PowerShell Kurulumu-I
• Windows XP Service Pack 2, Windows 2003
Service Pack 1
– http://www.microsoft.com/windowsserver2003/t
echnologies/management/powershell/download.
mspx
PowerShell Kurulumu-II
PowerShell Kurulumu-III
PowerShell Başlatılması
PowerShell Temel Özellikleri
 İnterAktif Kabuk ve Script Programlama da bir devrim
 .NET Tabanlı
 Yerleşik yaklaşık (~130) komut
 .NET’in avantajlarını kullanabilen yeni bir dil
 “nesne-tabanlı” pipeline görünümü
 Mevcut araçlara destek devam ediyor.
 (COM, ADSI, WMI, ADO, XML, Text, …)
 Otomatik Komut Tamamlama Özelliği
Merak Edilenler
• Powershell Kullanmadan Önce .NET
Öğrenmelimiyim?
– Hayır.
• Mevcut Kullandığım Script ve Araçları Yeniden
mi Yazmam Gerekiyor?
– Hayır
• Öğrenmem gereken bir dil var mı?
– Hayır.
– Çoğu DOS & UNIX komutunu kullanabilirsiniz.
CMDLETS
Verb Noun
Command
MSH> get-mailbox –server “smbex01”
Verb Noun
Name
Argument
String
Command Parameter
Property Names
Property Values
Name Alias Server StorageQuota
---- ---- ------ ------------
Bob Kelly bobk smbex01 unlimited
Kim Akers kima smbex01 unlimited
Exchange 2007’den bir örnek
DEMO
PWShell İle Alias Kullanımı
PWShell İle Alias Kullanımı - II
PWShell İle Alias Kullanımı - III
DEMO
PowerShell ile PipeLine Kullanımı
DEMO
Windows PowerShell EngineWindows PowerShell Engine
Custom ApplicationCustom Application
Microsoft Management Console 3.0Microsoft Management Console 3.0
PSObjectPSObject
Windows PowerShell CmdletsWindows PowerShell CmdletsCommandCommand
LineLine
GUIGUI
MMC 3.0 Layered Over
Windows PowerShell
Layered OverLayered Over
Windows FormsWindows Forms
Early Bound ObjectsEarly Bound Objects
YourYour
ApplicationApplication
To ManageTo Manage
PowerShell Engine
Exchange cmdlets
Configuration Data Access
AD
Registry Meta
base
MAPI
Store
Process
boundary
E2007Management ArchitectureE2007Management Architecture
Early-bound objs
WinForms
ADO.Net
PowerShell Data Provider
WinForms
CLI
GUI
Setup
• Exchange 2007
– Fully build on PowerShell, fully scriptable
• Add new users, mailboxes, mailstores…
– GUI has only a subset of features
• GUI “records” actions and present the PowerShell script at the end
• Virtual Machine Manager
– Fully build on PowerShell, fully scriptable
• Add new network cards, memory, processors…
• System Center Operations Manager
– Server features scriptable via PowerShell
• Data Protection Manager v2
– Fully on PowerShell
• System Center “Service Desk”
– PowerShell support, percentage ?
• Windows Server “Longhorn”
– New Server Manager fully scriptable
– Not on Server core! (no .net Framework!)
• Windows Server Compute Clusterv2
• Part of Common Engineering Criteria
– Version 2009
Microsoft Products using PowerShell
The command prompt knows how to handle
• “hello world”
• 2 + 3 = 5
• 2 + 3 + “4” = 9
• “4” + 2 = 42
• “hello” * 3 = hellohellohello
Object oriented everywhere
Variable Use with PowerShell
• You can use virtually any variable name you
choose, names are not case sensitive.
• But, there are illegal characters such as; ! @ #
% & , . and spaces. PowerShell will throw an
error if you use an illegal character.
– Must start with $
– $a = 32
– Can be typed
– [int]$a = 32
$Microsoft $MicroSoft $microsoft are The Same!
${My English Name is #merlin@} is OK!
Variable Type
• Powershell variable type is base on .NET
Framework.
• Common variable is as below:
– [adsi], [array], [bool], [byte], [char]
– [datetime], [decimal], [double]
– [int] or [int32], [long]
– [single], [scriptblock], [string]
– [WMI], [WMIclass], [xml]
Declaring Variables and Type Adaptation
• $a=333
• $b=“66”
• $c=SS
$a.GetType()
$b.GetType().Name
$a+$b ; $b+$a ??
$b+$c ; $c+$b ??
$a+$c ; $c+$a ??
Capture User Input
Use Read-Host to get user input
$a = Read-Host “Enter your name”
Write-Host "Hello" $a
All Variables are Object
• [int]$Age=22
• $Age.GetType()
• $Age GetType().Name
• $Age | Get-Member
• $Title=“manager”
• $Title.length
• $Title.CompareTo()
DEMO
Array
• To initialise
– $a = 1,2,4,8
• To query
– $b = $a[3]
PowerShell ile Sürücüler ve Registry
PSDrive
• VMI (Windows Management Instrumentation)
• PowerShell ortamından VMI Scriptlerini de
çalıştırabiliyoruz.
PowerShell ile VMI Uygulamaları
Powershell Operator
 Arithmetic Binary Operators
 +, -, *, , %, ++, --
 Assignment Operators
 =, +=, -=, *=, /=, %=
 Logical Operators
 !, -not, -and, -or
 String Operators
 +, *, -f, -replace, -match, -like
 Comparison Operators
 -eq, -ne, -gt, –ge, -lt, –le
Arithmetic Binary Operators
• 123+789 ; 222-876
• 34.5*44.2 ; 13/7
• 123%5
• $var++ ; ++$var  $var = $var + 1
• $var-- ; --$var  $var = $var – 1
Assignment Operators
• $var=3
• $var+=3 ; $var-=3
• $var*=3 ;$var/=3 ; $var%=3
• $var = 0x10  echo $var  16
• $var = 7.56e3  echo $var  7560
• $var=7MB  echo $var  7340043
(bytes)
Logical Operators
• (7 -eq 7) -and (2 -eq 5)
• (7 -eq 7) -or (2 -eq 5)
• (9 -eq 9) -xor (4 -eq 4) ; (9 -eq 9) -xor (4 -eq
7)
• (3 -eq 3) -and !(2 -eq 2)
• (3 -eq 3) -and -not (2 -eq 9)
String Operators
-like ; -clike ; -ilike To be like as
-notlike ; -cnotlike ;-inotlike To not be like as
-match ; -cmatch ;-imatch Match
-notmatch ; -cnotmatch ; -inotmatch Not match
-contains ; -ccontains ; -icontains Include
-notcontains; -cnotcontains ;
-inotcontains
Not include
Comparison Operators
• -le ; -cle ; -ile  <=
• -eq; -ceq; -ieq  =
• -ne; -cne; -ine  !=
• -gt; -cgt; -igt  >
• -ge; -cge; -ige  >=
• -lt; -clt; -ilt  <
• -le; -cle; ile  <=
Loop and Flow Control
• If…. elseif… else…
• Switch…… default
• ForEach ( Foreach-Object )
• For
• While
• Do….. While
• Do…..Until
• Break & Continue
If…. elseif… else…
$a = "white"
if ($a -eq "red")
{"The colour is red"}
elseif ($a -eq "white")
{"The colour is white"}
else
{"Another colour"}
Switch…… default
Another method to run a specific set of code
given specific conditions
$a = "red"
switch ($a)
{
"red" {"The colour is red"}
"white"{"The colour is white"}
default{"Another colour"}
}
ForEach ( Foreach-Object )
Loop through a collection of objects
Foreach ($i in Get-Childitem c:windows)
{$i.name; $i.creationtime}
For
Repeat the same steps a specific number of
times
For ($a=1; $a –le 10; $a++)
{$a}
While, do while, do until
Do While Loop
Can repeat a set of commands while a condition is met
$a=1
Do {$a; $a++}
While ($a –lt 10)
Do Until Loop
Can repeat a set of commands until a condition is met
$a=1
Do {$a; $a++}
Until ($a –gt 10)
Break; Continue
• For ($i = 1; $i -le 10; $i++) {
Write-Host $i
If ($i -eq 5) { Write-Host "BREAK!!“
Break } }
• ForEach ($i in 1..10) {
If ($i % 2) {
Continue }
$i }
Reduced Complexity
DEMO
• [void]
[reflection.assembly]::LoadWithPartialName("System.Windows.Forms")
• $form = new-object Windows.Forms.Form
• $form.Text = "My First Form"
• $button = new-object Windows.Forms.Button
• $button.text=“Çözümpark Tıklayın!"
• $button.Dock="fill"
• $button.add_click({$form.close()})
• $form.controls.add($button)
• $form.Add_Shown({$form.Activate()})
• $form.ShowDialog()
Form Uygulaması - Hello World
• PS1 – Windows PowerShell shell script
powershell.exe –noexit &”c:myscript.ps1”
• PS1XML – Windows PowerShell format and
type definitions
• PSC1 – Windows PowerShell console file
• PSD1 – Windows PowerShell data file
• PSM1 – Windows PowerShell module file
File extensions
• http://blogs.msdn.com/powershell/attachme
nt/1561580.ashx
PowerShell Cheat Sheet
• Microsoft is working on the next version of
PowerShell
• Installed by default on Windows Server 2008
R2 and Windows 7
• http://www.microsoft.com/downloads/details
.aspx?FamilyID=60deac2b-975b-41e6-9fa0-
c2fd6aa6bc89&displaylang=en
PowerShell 2.0
• PowerShell Remoting
• Background Jobs
• Transactions
• ScriptCmdlets
• Modules
• Script Debugging
• Eventing
• Windows PowerShell Integrated Scripting Environment
• Network File Transfer
• New Cmdlets
• New Operators
• Exception Handling with Try-Catch-Finally
PowerShell 2.0 Neler Getiriyor?
Daha Fazla Bilgi İçin
– Microsoft Press – Microsoft Windows PowerShell
Step By Step
– Manning – Windows PowerShell in Action
– Sams – Windows PowerShell Unleashed
– Sapien Press – Microsoft Windows PowerShell
– TechNet - Scripting with Windows PowerShell
– www.cozumpark.com
– http://blogs.msdn.com/powershell.
Sorularınız ?
Teşekkürler
www.cozumpark.com |
www.mesutaladag.com
Mesut ALADAĞ
Teknoloji Direktörü / MCT
mesutaladag@mayasoft.com.tr

Contenu connexe

Tendances

The promise of asynchronous php
The promise of asynchronous phpThe promise of asynchronous php
The promise of asynchronous phpWim Godden
 
PowerShell Technical Overview
PowerShell Technical OverviewPowerShell Technical Overview
PowerShell Technical Overviewallandcp
 
Deep Dive into AWS CLI - the command line interface
Deep Dive into AWS CLI - the command line interfaceDeep Dive into AWS CLI - the command line interface
Deep Dive into AWS CLI - the command line interfaceJohn Varghese
 
Let's play a game with blackfire player
Let's play a game with blackfire playerLet's play a game with blackfire player
Let's play a game with blackfire playerMarcin Czarnecki
 
My app is secure... I think
My app is secure... I thinkMy app is secure... I think
My app is secure... I thinkWim Godden
 
Introduction to PowerShell
Introduction to PowerShellIntroduction to PowerShell
Introduction to PowerShellSalaudeen Rajack
 
My app is secure... I think
My app is secure... I thinkMy app is secure... I think
My app is secure... I thinkWim Godden
 
Web2py Code Lab
Web2py Code LabWeb2py Code Lab
Web2py Code LabColin Su
 
Masterclass Advanced Usage of the AWS CLI
Masterclass Advanced Usage of the AWS CLIMasterclass Advanced Usage of the AWS CLI
Masterclass Advanced Usage of the AWS CLIDanilo Poccia
 
The worst Ruby codes I’ve seen in my life - RubyKaigi 2015
The worst Ruby codes I’ve seen in my life - RubyKaigi 2015The worst Ruby codes I’ve seen in my life - RubyKaigi 2015
The worst Ruby codes I’ve seen in my life - RubyKaigi 2015Fernando Hamasaki de Amorim
 
Doctrine MongoDB ODM (PDXPHP)
Doctrine MongoDB ODM (PDXPHP)Doctrine MongoDB ODM (PDXPHP)
Doctrine MongoDB ODM (PDXPHP)Kris Wallsmith
 
Scaling Symfony2 apps with RabbitMQ - Symfony UK Meetup
Scaling Symfony2 apps with RabbitMQ - Symfony UK MeetupScaling Symfony2 apps with RabbitMQ - Symfony UK Meetup
Scaling Symfony2 apps with RabbitMQ - Symfony UK MeetupKacper Gunia
 
Deep Dive - Advanced Usage of the AWS CLI
Deep Dive - Advanced Usage of the AWS CLIDeep Dive - Advanced Usage of the AWS CLI
Deep Dive - Advanced Usage of the AWS CLIAmazon Web Services
 
An Introduction to Windows PowerShell
An Introduction to Windows PowerShellAn Introduction to Windows PowerShell
An Introduction to Windows PowerShellDale Lane
 
Building Web Services with Zend Framework (PHP Benelux meeting 20100713 Vliss...
Building Web Services with Zend Framework (PHP Benelux meeting 20100713 Vliss...Building Web Services with Zend Framework (PHP Benelux meeting 20100713 Vliss...
Building Web Services with Zend Framework (PHP Benelux meeting 20100713 Vliss...King Foo
 
Forget about Index.php and build you applications around HTTP - PHPers Cracow
Forget about Index.php and build you applications around HTTP - PHPers CracowForget about Index.php and build you applications around HTTP - PHPers Cracow
Forget about Index.php and build you applications around HTTP - PHPers CracowKacper Gunia
 

Tendances (20)

The promise of asynchronous php
The promise of asynchronous phpThe promise of asynchronous php
The promise of asynchronous php
 
PowerShell Technical Overview
PowerShell Technical OverviewPowerShell Technical Overview
PowerShell Technical Overview
 
Deep Dive into AWS CLI - the command line interface
Deep Dive into AWS CLI - the command line interfaceDeep Dive into AWS CLI - the command line interface
Deep Dive into AWS CLI - the command line interface
 
Let's play a game with blackfire player
Let's play a game with blackfire playerLet's play a game with blackfire player
Let's play a game with blackfire player
 
My app is secure... I think
My app is secure... I thinkMy app is secure... I think
My app is secure... I think
 
CodeIgniter 3.0
CodeIgniter 3.0CodeIgniter 3.0
CodeIgniter 3.0
 
Play!ng with scala
Play!ng with scalaPlay!ng with scala
Play!ng with scala
 
Introduction to PowerShell
Introduction to PowerShellIntroduction to PowerShell
Introduction to PowerShell
 
My app is secure... I think
My app is secure... I thinkMy app is secure... I think
My app is secure... I think
 
Web2py Code Lab
Web2py Code LabWeb2py Code Lab
Web2py Code Lab
 
PowerShell-1
PowerShell-1PowerShell-1
PowerShell-1
 
Masterclass Advanced Usage of the AWS CLI
Masterclass Advanced Usage of the AWS CLIMasterclass Advanced Usage of the AWS CLI
Masterclass Advanced Usage of the AWS CLI
 
The worst Ruby codes I’ve seen in my life - RubyKaigi 2015
The worst Ruby codes I’ve seen in my life - RubyKaigi 2015The worst Ruby codes I’ve seen in my life - RubyKaigi 2015
The worst Ruby codes I’ve seen in my life - RubyKaigi 2015
 
Doctrine MongoDB ODM (PDXPHP)
Doctrine MongoDB ODM (PDXPHP)Doctrine MongoDB ODM (PDXPHP)
Doctrine MongoDB ODM (PDXPHP)
 
Scaling Symfony2 apps with RabbitMQ - Symfony UK Meetup
Scaling Symfony2 apps with RabbitMQ - Symfony UK MeetupScaling Symfony2 apps with RabbitMQ - Symfony UK Meetup
Scaling Symfony2 apps with RabbitMQ - Symfony UK Meetup
 
Deep Dive - Advanced Usage of the AWS CLI
Deep Dive - Advanced Usage of the AWS CLIDeep Dive - Advanced Usage of the AWS CLI
Deep Dive - Advanced Usage of the AWS CLI
 
Play á la Rails
Play á la RailsPlay á la Rails
Play á la Rails
 
An Introduction to Windows PowerShell
An Introduction to Windows PowerShellAn Introduction to Windows PowerShell
An Introduction to Windows PowerShell
 
Building Web Services with Zend Framework (PHP Benelux meeting 20100713 Vliss...
Building Web Services with Zend Framework (PHP Benelux meeting 20100713 Vliss...Building Web Services with Zend Framework (PHP Benelux meeting 20100713 Vliss...
Building Web Services with Zend Framework (PHP Benelux meeting 20100713 Vliss...
 
Forget about Index.php and build you applications around HTTP - PHPers Cracow
Forget about Index.php and build you applications around HTTP - PHPers CracowForget about Index.php and build you applications around HTTP - PHPers Cracow
Forget about Index.php and build you applications around HTTP - PHPers Cracow
 

En vedette

Office 365 & PowerShell - A match made in heaven
Office 365 & PowerShell - A match made in heavenOffice 365 & PowerShell - A match made in heaven
Office 365 & PowerShell - A match made in heavenSébastien Levert
 
Better, Faster, Stronger! Boost Your Team-Based SharePoint Development Using ...
Better, Faster, Stronger! Boost Your Team-Based SharePoint Development Using ...Better, Faster, Stronger! Boost Your Team-Based SharePoint Development Using ...
Better, Faster, Stronger! Boost Your Team-Based SharePoint Development Using ...Richard Calderon
 
Practical PowerShell Programming for Professional People - Extended Edition
Practical PowerShell Programming for Professional People - Extended EditionPractical PowerShell Programming for Professional People - Extended Edition
Practical PowerShell Programming for Professional People - Extended EditionBen Ten (0xA)
 
Power on, Powershell
Power on, PowershellPower on, Powershell
Power on, PowershellRoo7break
 
PowerShell Plus v4.7 Overview
PowerShell Plus v4.7 OverviewPowerShell Plus v4.7 Overview
PowerShell Plus v4.7 OverviewRichard Giles
 
Powershell Seminar @ ITWorx CuttingEdge Club
Powershell Seminar @ ITWorx CuttingEdge ClubPowershell Seminar @ ITWorx CuttingEdge Club
Powershell Seminar @ ITWorx CuttingEdge ClubEssam Salah
 
PowerShell from *nix user perspective
PowerShell from *nix user perspectivePowerShell from *nix user perspective
PowerShell from *nix user perspectiveJuraj Michálek
 
Managing Virtual Infrastructures With PowerShell
Managing Virtual Infrastructures With PowerShellManaging Virtual Infrastructures With PowerShell
Managing Virtual Infrastructures With PowerShellguesta849bc8b
 
PowerShell 101
PowerShell 101PowerShell 101
PowerShell 101Thomas Lee
 
Incorporating PowerShell into your Arsenal with PS>Attack
Incorporating PowerShell into your Arsenal with PS>AttackIncorporating PowerShell into your Arsenal with PS>Attack
Incorporating PowerShell into your Arsenal with PS>Attackjaredhaight
 
Getting Started With PowerShell Scripting
Getting Started With PowerShell ScriptingGetting Started With PowerShell Scripting
Getting Started With PowerShell ScriptingRavikanth Chaganti
 
Windows - Having Its Ass Kicked by Puppet and PowerShell Since 2012
Windows - Having Its Ass Kicked by Puppet and PowerShell Since 2012Windows - Having Its Ass Kicked by Puppet and PowerShell Since 2012
Windows - Having Its Ass Kicked by Puppet and PowerShell Since 2012Puppet
 
Geek Sync | Using PowerShell with Python and SQL Server
Geek Sync | Using PowerShell with Python and SQL ServerGeek Sync | Using PowerShell with Python and SQL Server
Geek Sync | Using PowerShell with Python and SQL ServerIDERA Software
 
Gray Hat PowerShell - ShowMeCon 2015
Gray Hat PowerShell - ShowMeCon 2015Gray Hat PowerShell - ShowMeCon 2015
Gray Hat PowerShell - ShowMeCon 2015Ben Ten (0xA)
 
Network Mapping with PowerShell
Network Mapping with PowerShellNetwork Mapping with PowerShell
Network Mapping with PowerShellCostin-Alin Neacsu
 
Practical PowerShell Programming for Professional People
Practical PowerShell Programming for Professional PeoplePractical PowerShell Programming for Professional People
Practical PowerShell Programming for Professional PeopleBen Ten (0xA)
 
Workshop: PowerShell for Penetration Testers
Workshop: PowerShell for Penetration TestersWorkshop: PowerShell for Penetration Testers
Workshop: PowerShell for Penetration TestersNikhil Mittal
 
PowerShell 101 - What is it and Why should YOU Care!
PowerShell 101 - What is it and Why should YOU Care!PowerShell 101 - What is it and Why should YOU Care!
PowerShell 101 - What is it and Why should YOU Care!Thomas Lee
 
44CON London 2015 - Old Dog, New Tricks: Forensics With PowerShell
44CON London 2015 - Old Dog, New Tricks: Forensics With PowerShell44CON London 2015 - Old Dog, New Tricks: Forensics With PowerShell
44CON London 2015 - Old Dog, New Tricks: Forensics With PowerShell44CON
 

En vedette (20)

Office 365 & PowerShell - A match made in heaven
Office 365 & PowerShell - A match made in heavenOffice 365 & PowerShell - A match made in heaven
Office 365 & PowerShell - A match made in heaven
 
Better, Faster, Stronger! Boost Your Team-Based SharePoint Development Using ...
Better, Faster, Stronger! Boost Your Team-Based SharePoint Development Using ...Better, Faster, Stronger! Boost Your Team-Based SharePoint Development Using ...
Better, Faster, Stronger! Boost Your Team-Based SharePoint Development Using ...
 
Practical PowerShell Programming for Professional People - Extended Edition
Practical PowerShell Programming for Professional People - Extended EditionPractical PowerShell Programming for Professional People - Extended Edition
Practical PowerShell Programming for Professional People - Extended Edition
 
Power on, Powershell
Power on, PowershellPower on, Powershell
Power on, Powershell
 
PowerShell Plus v4.7 Overview
PowerShell Plus v4.7 OverviewPowerShell Plus v4.7 Overview
PowerShell Plus v4.7 Overview
 
Powershell Seminar @ ITWorx CuttingEdge Club
Powershell Seminar @ ITWorx CuttingEdge ClubPowershell Seminar @ ITWorx CuttingEdge Club
Powershell Seminar @ ITWorx CuttingEdge Club
 
PowerShell from *nix user perspective
PowerShell from *nix user perspectivePowerShell from *nix user perspective
PowerShell from *nix user perspective
 
Managing Virtual Infrastructures With PowerShell
Managing Virtual Infrastructures With PowerShellManaging Virtual Infrastructures With PowerShell
Managing Virtual Infrastructures With PowerShell
 
PowerShell UIAtomation
PowerShell UIAtomationPowerShell UIAtomation
PowerShell UIAtomation
 
PowerShell 101
PowerShell 101PowerShell 101
PowerShell 101
 
Incorporating PowerShell into your Arsenal with PS>Attack
Incorporating PowerShell into your Arsenal with PS>AttackIncorporating PowerShell into your Arsenal with PS>Attack
Incorporating PowerShell into your Arsenal with PS>Attack
 
Getting Started With PowerShell Scripting
Getting Started With PowerShell ScriptingGetting Started With PowerShell Scripting
Getting Started With PowerShell Scripting
 
Windows - Having Its Ass Kicked by Puppet and PowerShell Since 2012
Windows - Having Its Ass Kicked by Puppet and PowerShell Since 2012Windows - Having Its Ass Kicked by Puppet and PowerShell Since 2012
Windows - Having Its Ass Kicked by Puppet and PowerShell Since 2012
 
Geek Sync | Using PowerShell with Python and SQL Server
Geek Sync | Using PowerShell with Python and SQL ServerGeek Sync | Using PowerShell with Python and SQL Server
Geek Sync | Using PowerShell with Python and SQL Server
 
Gray Hat PowerShell - ShowMeCon 2015
Gray Hat PowerShell - ShowMeCon 2015Gray Hat PowerShell - ShowMeCon 2015
Gray Hat PowerShell - ShowMeCon 2015
 
Network Mapping with PowerShell
Network Mapping with PowerShellNetwork Mapping with PowerShell
Network Mapping with PowerShell
 
Practical PowerShell Programming for Professional People
Practical PowerShell Programming for Professional PeoplePractical PowerShell Programming for Professional People
Practical PowerShell Programming for Professional People
 
Workshop: PowerShell for Penetration Testers
Workshop: PowerShell for Penetration TestersWorkshop: PowerShell for Penetration Testers
Workshop: PowerShell for Penetration Testers
 
PowerShell 101 - What is it and Why should YOU Care!
PowerShell 101 - What is it and Why should YOU Care!PowerShell 101 - What is it and Why should YOU Care!
PowerShell 101 - What is it and Why should YOU Care!
 
44CON London 2015 - Old Dog, New Tricks: Forensics With PowerShell
44CON London 2015 - Old Dog, New Tricks: Forensics With PowerShell44CON London 2015 - Old Dog, New Tricks: Forensics With PowerShell
44CON London 2015 - Old Dog, New Tricks: Forensics With PowerShell
 

Similaire à PowerShell Scripting Uygulamaları Sunumu

Powershell Tech Ed2009
Powershell Tech Ed2009Powershell Tech Ed2009
Powershell Tech Ed2009rsnarayanan
 
Introduction to PowerShell - Be a PowerShell Hero - SPFest workshop
Introduction to PowerShell - Be a PowerShell Hero - SPFest workshopIntroduction to PowerShell - Be a PowerShell Hero - SPFest workshop
Introduction to PowerShell - Be a PowerShell Hero - SPFest workshopMichael Blumenthal (Microsoft MVP)
 
Power shell training
Power shell trainingPower shell training
Power shell trainingDavid Brabant
 
PowerShell for SharePoint Admins
PowerShell for SharePoint AdminsPowerShell for SharePoint Admins
PowerShell for SharePoint AdminsRick Taylor
 
SPugPt Meeting 35: Manage govern and drive adoption of share point online wit...
SPugPt Meeting 35: Manage govern and drive adoption of share point online wit...SPugPt Meeting 35: Manage govern and drive adoption of share point online wit...
SPugPt Meeting 35: Manage govern and drive adoption of share point online wit...Comunidade Portuguesa de SharePoiint
 
Javascript first-class citizenery
Javascript first-class citizeneryJavascript first-class citizenery
Javascript first-class citizenerytoddbr
 
Introduction to PowerShell for SharePoint Admins and Developers - SharePoint ...
Introduction to PowerShell for SharePoint Admins and Developers - SharePoint ...Introduction to PowerShell for SharePoint Admins and Developers - SharePoint ...
Introduction to PowerShell for SharePoint Admins and Developers - SharePoint ...Michael Blumenthal (Microsoft MVP)
 
Power shell for sp admins
Power shell for sp adminsPower shell for sp admins
Power shell for sp adminsRick Taylor
 
Cognitive data capture with Elis - Rossum's technical webinar
Cognitive data capture with Elis - Rossum's technical webinarCognitive data capture with Elis - Rossum's technical webinar
Cognitive data capture with Elis - Rossum's technical webinarPetr Baudis
 
Charla EHU Noviembre 2014 - Desarrollo Web
Charla EHU Noviembre 2014 - Desarrollo WebCharla EHU Noviembre 2014 - Desarrollo Web
Charla EHU Noviembre 2014 - Desarrollo WebMikel Torres Ugarte
 
PowerShellForDBDevelopers
PowerShellForDBDevelopersPowerShellForDBDevelopers
PowerShellForDBDevelopersBryan Cafferky
 
Workshop quality assurance for php projects tek12
Workshop quality assurance for php projects tek12Workshop quality assurance for php projects tek12
Workshop quality assurance for php projects tek12Michelangelo van Dam
 
SharePoint Saturday Ottawa 2015 - Office 365 and PowerShell - A match made in...
SharePoint Saturday Ottawa 2015 - Office 365 and PowerShell - A match made in...SharePoint Saturday Ottawa 2015 - Office 365 and PowerShell - A match made in...
SharePoint Saturday Ottawa 2015 - Office 365 and PowerShell - A match made in...Sébastien Levert
 
Supercharging WordPress Development - Wordcamp Brighton 2019
Supercharging WordPress Development - Wordcamp Brighton 2019Supercharging WordPress Development - Wordcamp Brighton 2019
Supercharging WordPress Development - Wordcamp Brighton 2019Adam Tomat
 
Webinar - Office 365 & PowerShell : A Match Made in Heaven
Webinar - Office 365 & PowerShell : A Match Made in HeavenWebinar - Office 365 & PowerShell : A Match Made in Heaven
Webinar - Office 365 & PowerShell : A Match Made in HeavenSébastien Levert
 
NIIT ISAS Q5 Report - Windows PowerShell
NIIT ISAS Q5 Report - Windows PowerShellNIIT ISAS Q5 Report - Windows PowerShell
NIIT ISAS Q5 Report - Windows PowerShellPhan Hien
 
Get-Help: An intro to PowerShell and how to Use it for Evil
Get-Help: An intro to PowerShell and how to Use it for EvilGet-Help: An intro to PowerShell and how to Use it for Evil
Get-Help: An intro to PowerShell and how to Use it for Eviljaredhaight
 
Expanding your impact with programmability in the data center
Expanding your impact with programmability in the data centerExpanding your impact with programmability in the data center
Expanding your impact with programmability in the data centerCisco Canada
 

Similaire à PowerShell Scripting Uygulamaları Sunumu (20)

Powershell Tech Ed2009
Powershell Tech Ed2009Powershell Tech Ed2009
Powershell Tech Ed2009
 
Introduction to PowerShell - Be a PowerShell Hero - SPFest workshop
Introduction to PowerShell - Be a PowerShell Hero - SPFest workshopIntroduction to PowerShell - Be a PowerShell Hero - SPFest workshop
Introduction to PowerShell - Be a PowerShell Hero - SPFest workshop
 
Revoke-Obfuscation
Revoke-ObfuscationRevoke-Obfuscation
Revoke-Obfuscation
 
PHP FUNCTIONS
PHP FUNCTIONSPHP FUNCTIONS
PHP FUNCTIONS
 
Power shell training
Power shell trainingPower shell training
Power shell training
 
PowerShell for SharePoint Admins
PowerShell for SharePoint AdminsPowerShell for SharePoint Admins
PowerShell for SharePoint Admins
 
SPugPt Meeting 35: Manage govern and drive adoption of share point online wit...
SPugPt Meeting 35: Manage govern and drive adoption of share point online wit...SPugPt Meeting 35: Manage govern and drive adoption of share point online wit...
SPugPt Meeting 35: Manage govern and drive adoption of share point online wit...
 
Javascript first-class citizenery
Javascript first-class citizeneryJavascript first-class citizenery
Javascript first-class citizenery
 
Introduction to PowerShell for SharePoint Admins and Developers - SharePoint ...
Introduction to PowerShell for SharePoint Admins and Developers - SharePoint ...Introduction to PowerShell for SharePoint Admins and Developers - SharePoint ...
Introduction to PowerShell for SharePoint Admins and Developers - SharePoint ...
 
Power shell for sp admins
Power shell for sp adminsPower shell for sp admins
Power shell for sp admins
 
Cognitive data capture with Elis - Rossum's technical webinar
Cognitive data capture with Elis - Rossum's technical webinarCognitive data capture with Elis - Rossum's technical webinar
Cognitive data capture with Elis - Rossum's technical webinar
 
Charla EHU Noviembre 2014 - Desarrollo Web
Charla EHU Noviembre 2014 - Desarrollo WebCharla EHU Noviembre 2014 - Desarrollo Web
Charla EHU Noviembre 2014 - Desarrollo Web
 
PowerShellForDBDevelopers
PowerShellForDBDevelopersPowerShellForDBDevelopers
PowerShellForDBDevelopers
 
Workshop quality assurance for php projects tek12
Workshop quality assurance for php projects tek12Workshop quality assurance for php projects tek12
Workshop quality assurance for php projects tek12
 
SharePoint Saturday Ottawa 2015 - Office 365 and PowerShell - A match made in...
SharePoint Saturday Ottawa 2015 - Office 365 and PowerShell - A match made in...SharePoint Saturday Ottawa 2015 - Office 365 and PowerShell - A match made in...
SharePoint Saturday Ottawa 2015 - Office 365 and PowerShell - A match made in...
 
Supercharging WordPress Development - Wordcamp Brighton 2019
Supercharging WordPress Development - Wordcamp Brighton 2019Supercharging WordPress Development - Wordcamp Brighton 2019
Supercharging WordPress Development - Wordcamp Brighton 2019
 
Webinar - Office 365 & PowerShell : A Match Made in Heaven
Webinar - Office 365 & PowerShell : A Match Made in HeavenWebinar - Office 365 & PowerShell : A Match Made in Heaven
Webinar - Office 365 & PowerShell : A Match Made in Heaven
 
NIIT ISAS Q5 Report - Windows PowerShell
NIIT ISAS Q5 Report - Windows PowerShellNIIT ISAS Q5 Report - Windows PowerShell
NIIT ISAS Q5 Report - Windows PowerShell
 
Get-Help: An intro to PowerShell and how to Use it for Evil
Get-Help: An intro to PowerShell and how to Use it for EvilGet-Help: An intro to PowerShell and how to Use it for Evil
Get-Help: An intro to PowerShell and how to Use it for Evil
 
Expanding your impact with programmability in the data center
Expanding your impact with programmability in the data centerExpanding your impact with programmability in the data center
Expanding your impact with programmability in the data center
 

Plus de ÇözümPARK

Office Communications Server Ayrintili Inceleme
Office Communications Server Ayrintili IncelemeOffice Communications Server Ayrintili Inceleme
Office Communications Server Ayrintili IncelemeÇözümPARK
 
Group Policy ve Yonetim Araclari
Group Policy ve Yonetim AraclariGroup Policy ve Yonetim Araclari
Group Policy ve Yonetim AraclariÇözümPARK
 
Windows Server 2008 R2 Üzerinde Hyper-V ile Gelen Yenilikler
Windows Server 2008 R2 Üzerinde Hyper-V ile Gelen YeniliklerWindows Server 2008 R2 Üzerinde Hyper-V ile Gelen Yenilikler
Windows Server 2008 R2 Üzerinde Hyper-V ile Gelen YeniliklerÇözümPARK
 
System Center Virtual Machine Manager 2008
System Center Virtual Machine Manager 2008System Center Virtual Machine Manager 2008
System Center Virtual Machine Manager 2008ÇözümPARK
 
Sunucu Sanallaştırma ve Hyper-V2
Sunucu Sanallaştırma ve Hyper-V2Sunucu Sanallaştırma ve Hyper-V2
Sunucu Sanallaştırma ve Hyper-V2ÇözümPARK
 
Microsoft Hyper V Server 2008 Sunucu Sanallaştırma
Microsoft Hyper V Server 2008 Sunucu SanallaştırmaMicrosoft Hyper V Server 2008 Sunucu Sanallaştırma
Microsoft Hyper V Server 2008 Sunucu SanallaştırmaÇözümPARK
 
Windows Server 2008 R2 Yenilikleri
Windows Server 2008 R2 YenilikleriWindows Server 2008 R2 Yenilikleri
Windows Server 2008 R2 YenilikleriÇözümPARK
 
Windows Server 2003 to Windows Server 2008 Domain Upgrade
Windows Server 2003 to Windows Server 2008 Domain UpgradeWindows Server 2003 to Windows Server 2008 Domain Upgrade
Windows Server 2003 to Windows Server 2008 Domain UpgradeÇözümPARK
 
Windows Server 2008 Server Core
Windows Server 2008 Server CoreWindows Server 2008 Server Core
Windows Server 2008 Server CoreÇözümPARK
 
System Center Operations Manager 2007 Management Pack Yönetimi ve Server Perf...
System Center Operations Manager 2007 Management Pack Yönetimi ve Server Perf...System Center Operations Manager 2007 Management Pack Yönetimi ve Server Perf...
System Center Operations Manager 2007 Management Pack Yönetimi ve Server Perf...ÇözümPARK
 
System Center Operations Manager 2007 Kurulum,Client Discovery ve Performans ...
System Center Operations Manager 2007 Kurulum,Client Discovery ve Performans ...System Center Operations Manager 2007 Kurulum,Client Discovery ve Performans ...
System Center Operations Manager 2007 Kurulum,Client Discovery ve Performans ...ÇözümPARK
 
System Center Data Protection Manager 2007 Kurulum
System Center Data Protection Manager 2007 KurulumSystem Center Data Protection Manager 2007 Kurulum
System Center Data Protection Manager 2007 KurulumÇözümPARK
 
Microsoft Small Business Server 2008
Microsoft Small Business Server 2008Microsoft Small Business Server 2008
Microsoft Small Business Server 2008ÇözümPARK
 
Microsoft Small Business Server 2008
Microsoft Small Business Server 2008Microsoft Small Business Server 2008
Microsoft Small Business Server 2008ÇözümPARK
 
Microsoft System Center ile Yönetim
Microsoft System Center ile YönetimMicrosoft System Center ile Yönetim
Microsoft System Center ile YönetimÇözümPARK
 
Microsoft Exchange 2010 Teknik Bakis
Microsoft Exchange 2010 Teknik BakisMicrosoft Exchange 2010 Teknik Bakis
Microsoft Exchange 2010 Teknik BakisÇözümPARK
 
Micrososft Exchange Server 2010 Yukseltme Senaryolari
Micrososft Exchange Server 2010 Yukseltme SenaryolariMicrososft Exchange Server 2010 Yukseltme Senaryolari
Micrososft Exchange Server 2010 Yukseltme SenaryolariÇözümPARK
 
Microsoft Exchange Server 2010 Genel
Microsoft Exchange Server 2010 GenelMicrosoft Exchange Server 2010 Genel
Microsoft Exchange Server 2010 GenelÇözümPARK
 
Threat management Gateway 2010
Threat management Gateway 2010Threat management Gateway 2010
Threat management Gateway 2010ÇözümPARK
 

Plus de ÇözümPARK (20)

Forefront UAG
Forefront UAGForefront UAG
Forefront UAG
 
Office Communications Server Ayrintili Inceleme
Office Communications Server Ayrintili IncelemeOffice Communications Server Ayrintili Inceleme
Office Communications Server Ayrintili Inceleme
 
Group Policy ve Yonetim Araclari
Group Policy ve Yonetim AraclariGroup Policy ve Yonetim Araclari
Group Policy ve Yonetim Araclari
 
Windows Server 2008 R2 Üzerinde Hyper-V ile Gelen Yenilikler
Windows Server 2008 R2 Üzerinde Hyper-V ile Gelen YeniliklerWindows Server 2008 R2 Üzerinde Hyper-V ile Gelen Yenilikler
Windows Server 2008 R2 Üzerinde Hyper-V ile Gelen Yenilikler
 
System Center Virtual Machine Manager 2008
System Center Virtual Machine Manager 2008System Center Virtual Machine Manager 2008
System Center Virtual Machine Manager 2008
 
Sunucu Sanallaştırma ve Hyper-V2
Sunucu Sanallaştırma ve Hyper-V2Sunucu Sanallaştırma ve Hyper-V2
Sunucu Sanallaştırma ve Hyper-V2
 
Microsoft Hyper V Server 2008 Sunucu Sanallaştırma
Microsoft Hyper V Server 2008 Sunucu SanallaştırmaMicrosoft Hyper V Server 2008 Sunucu Sanallaştırma
Microsoft Hyper V Server 2008 Sunucu Sanallaştırma
 
Windows Server 2008 R2 Yenilikleri
Windows Server 2008 R2 YenilikleriWindows Server 2008 R2 Yenilikleri
Windows Server 2008 R2 Yenilikleri
 
Windows Server 2003 to Windows Server 2008 Domain Upgrade
Windows Server 2003 to Windows Server 2008 Domain UpgradeWindows Server 2003 to Windows Server 2008 Domain Upgrade
Windows Server 2003 to Windows Server 2008 Domain Upgrade
 
Windows Server 2008 Server Core
Windows Server 2008 Server CoreWindows Server 2008 Server Core
Windows Server 2008 Server Core
 
System Center Operations Manager 2007 Management Pack Yönetimi ve Server Perf...
System Center Operations Manager 2007 Management Pack Yönetimi ve Server Perf...System Center Operations Manager 2007 Management Pack Yönetimi ve Server Perf...
System Center Operations Manager 2007 Management Pack Yönetimi ve Server Perf...
 
System Center Operations Manager 2007 Kurulum,Client Discovery ve Performans ...
System Center Operations Manager 2007 Kurulum,Client Discovery ve Performans ...System Center Operations Manager 2007 Kurulum,Client Discovery ve Performans ...
System Center Operations Manager 2007 Kurulum,Client Discovery ve Performans ...
 
System Center Data Protection Manager 2007 Kurulum
System Center Data Protection Manager 2007 KurulumSystem Center Data Protection Manager 2007 Kurulum
System Center Data Protection Manager 2007 Kurulum
 
Microsoft Small Business Server 2008
Microsoft Small Business Server 2008Microsoft Small Business Server 2008
Microsoft Small Business Server 2008
 
Microsoft Small Business Server 2008
Microsoft Small Business Server 2008Microsoft Small Business Server 2008
Microsoft Small Business Server 2008
 
Microsoft System Center ile Yönetim
Microsoft System Center ile YönetimMicrosoft System Center ile Yönetim
Microsoft System Center ile Yönetim
 
Microsoft Exchange 2010 Teknik Bakis
Microsoft Exchange 2010 Teknik BakisMicrosoft Exchange 2010 Teknik Bakis
Microsoft Exchange 2010 Teknik Bakis
 
Micrososft Exchange Server 2010 Yukseltme Senaryolari
Micrososft Exchange Server 2010 Yukseltme SenaryolariMicrososft Exchange Server 2010 Yukseltme Senaryolari
Micrososft Exchange Server 2010 Yukseltme Senaryolari
 
Microsoft Exchange Server 2010 Genel
Microsoft Exchange Server 2010 GenelMicrosoft Exchange Server 2010 Genel
Microsoft Exchange Server 2010 Genel
 
Threat management Gateway 2010
Threat management Gateway 2010Threat management Gateway 2010
Threat management Gateway 2010
 

PowerShell Scripting Uygulamaları Sunumu

  • 1. { PowerShell Scripting Uygulamaları} Mesut ALADAĞ Teknoloji Direktörü / MCT mesutaladag@mayasoft.com.tr Sunumumuz 15:00’da başlayacaktır…
  • 2. Ajanda • PowerShell Nedir? • PowerShell Kurulumu • PowerShell Giriş ve Özellikler • Temel Komutlar • Değişken ve Operatör Kullanımı • Döngüler ve Akış Kontrol Deyimleri • Genel Uygulamalar • PowerShell’in Geleceği
  • 4. • Before you install Windows PowerShell, be sure that your system has the software programs that Windows PowerShell requires. Windows PowerShell requires the following programs: • Windows XP Service Pack 2, Windows 2003 Service Pack 1, or later versions of Windows • Microsoft .NET Framework 2.0 • If any version of Windows PowerShell is already installed on the computer, use Add or Remove Programs in Control Panel to uninstall it before installing a new version. PowerShell Kurulumu-I
  • 5. • Windows XP Service Pack 2, Windows 2003 Service Pack 1 – http://www.microsoft.com/windowsserver2003/t echnologies/management/powershell/download. mspx PowerShell Kurulumu-II
  • 8. PowerShell Temel Özellikleri  İnterAktif Kabuk ve Script Programlama da bir devrim  .NET Tabanlı  Yerleşik yaklaşık (~130) komut  .NET’in avantajlarını kullanabilen yeni bir dil  “nesne-tabanlı” pipeline görünümü  Mevcut araçlara destek devam ediyor.  (COM, ADSI, WMI, ADO, XML, Text, …)  Otomatik Komut Tamamlama Özelliği
  • 9. Merak Edilenler • Powershell Kullanmadan Önce .NET Öğrenmelimiyim? – Hayır. • Mevcut Kullandığım Script ve Araçları Yeniden mi Yazmam Gerekiyor? – Hayır • Öğrenmem gereken bir dil var mı? – Hayır. – Çoğu DOS & UNIX komutunu kullanabilirsiniz.
  • 11. MSH> get-mailbox –server “smbex01” Verb Noun Name Argument String Command Parameter Property Names Property Values Name Alias Server StorageQuota ---- ---- ------ ------------ Bob Kelly bobk smbex01 unlimited Kim Akers kima smbex01 unlimited Exchange 2007’den bir örnek
  • 12. DEMO
  • 13. PWShell İle Alias Kullanımı
  • 14. PWShell İle Alias Kullanımı - II
  • 15. PWShell İle Alias Kullanımı - III
  • 16. DEMO
  • 17. PowerShell ile PipeLine Kullanımı
  • 18. DEMO
  • 19. Windows PowerShell EngineWindows PowerShell Engine Custom ApplicationCustom Application Microsoft Management Console 3.0Microsoft Management Console 3.0 PSObjectPSObject Windows PowerShell CmdletsWindows PowerShell CmdletsCommandCommand LineLine GUIGUI MMC 3.0 Layered Over Windows PowerShell Layered OverLayered Over Windows FormsWindows Forms Early Bound ObjectsEarly Bound Objects YourYour ApplicationApplication To ManageTo Manage
  • 20. PowerShell Engine Exchange cmdlets Configuration Data Access AD Registry Meta base MAPI Store Process boundary E2007Management ArchitectureE2007Management Architecture Early-bound objs WinForms ADO.Net PowerShell Data Provider WinForms CLI GUI Setup
  • 21. • Exchange 2007 – Fully build on PowerShell, fully scriptable • Add new users, mailboxes, mailstores… – GUI has only a subset of features • GUI “records” actions and present the PowerShell script at the end • Virtual Machine Manager – Fully build on PowerShell, fully scriptable • Add new network cards, memory, processors… • System Center Operations Manager – Server features scriptable via PowerShell • Data Protection Manager v2 – Fully on PowerShell • System Center “Service Desk” – PowerShell support, percentage ? • Windows Server “Longhorn” – New Server Manager fully scriptable – Not on Server core! (no .net Framework!) • Windows Server Compute Clusterv2 • Part of Common Engineering Criteria – Version 2009 Microsoft Products using PowerShell
  • 22. The command prompt knows how to handle • “hello world” • 2 + 3 = 5 • 2 + 3 + “4” = 9 • “4” + 2 = 42 • “hello” * 3 = hellohellohello Object oriented everywhere
  • 23. Variable Use with PowerShell • You can use virtually any variable name you choose, names are not case sensitive. • But, there are illegal characters such as; ! @ # % & , . and spaces. PowerShell will throw an error if you use an illegal character. – Must start with $ – $a = 32 – Can be typed – [int]$a = 32 $Microsoft $MicroSoft $microsoft are The Same! ${My English Name is #merlin@} is OK!
  • 24. Variable Type • Powershell variable type is base on .NET Framework. • Common variable is as below: – [adsi], [array], [bool], [byte], [char] – [datetime], [decimal], [double] – [int] or [int32], [long] – [single], [scriptblock], [string] – [WMI], [WMIclass], [xml]
  • 25. Declaring Variables and Type Adaptation • $a=333 • $b=“66” • $c=SS $a.GetType() $b.GetType().Name $a+$b ; $b+$a ?? $b+$c ; $c+$b ?? $a+$c ; $c+$a ?? Capture User Input Use Read-Host to get user input $a = Read-Host “Enter your name” Write-Host "Hello" $a
  • 26. All Variables are Object • [int]$Age=22 • $Age.GetType() • $Age GetType().Name • $Age | Get-Member • $Title=“manager” • $Title.length • $Title.CompareTo()
  • 27. DEMO
  • 28. Array • To initialise – $a = 1,2,4,8 • To query – $b = $a[3]
  • 29. PowerShell ile Sürücüler ve Registry PSDrive
  • 30. • VMI (Windows Management Instrumentation) • PowerShell ortamından VMI Scriptlerini de çalıştırabiliyoruz. PowerShell ile VMI Uygulamaları
  • 31. Powershell Operator  Arithmetic Binary Operators  +, -, *, , %, ++, --  Assignment Operators  =, +=, -=, *=, /=, %=  Logical Operators  !, -not, -and, -or  String Operators  +, *, -f, -replace, -match, -like  Comparison Operators  -eq, -ne, -gt, –ge, -lt, –le
  • 32. Arithmetic Binary Operators • 123+789 ; 222-876 • 34.5*44.2 ; 13/7 • 123%5 • $var++ ; ++$var  $var = $var + 1 • $var-- ; --$var  $var = $var – 1
  • 33. Assignment Operators • $var=3 • $var+=3 ; $var-=3 • $var*=3 ;$var/=3 ; $var%=3 • $var = 0x10  echo $var  16 • $var = 7.56e3  echo $var  7560 • $var=7MB  echo $var  7340043 (bytes)
  • 34. Logical Operators • (7 -eq 7) -and (2 -eq 5) • (7 -eq 7) -or (2 -eq 5) • (9 -eq 9) -xor (4 -eq 4) ; (9 -eq 9) -xor (4 -eq 7) • (3 -eq 3) -and !(2 -eq 2) • (3 -eq 3) -and -not (2 -eq 9)
  • 35. String Operators -like ; -clike ; -ilike To be like as -notlike ; -cnotlike ;-inotlike To not be like as -match ; -cmatch ;-imatch Match -notmatch ; -cnotmatch ; -inotmatch Not match -contains ; -ccontains ; -icontains Include -notcontains; -cnotcontains ; -inotcontains Not include
  • 36. Comparison Operators • -le ; -cle ; -ile  <= • -eq; -ceq; -ieq  = • -ne; -cne; -ine  != • -gt; -cgt; -igt  > • -ge; -cge; -ige  >= • -lt; -clt; -ilt  < • -le; -cle; ile  <=
  • 37. Loop and Flow Control • If…. elseif… else… • Switch…… default • ForEach ( Foreach-Object ) • For • While • Do….. While • Do…..Until • Break & Continue
  • 38. If…. elseif… else… $a = "white" if ($a -eq "red") {"The colour is red"} elseif ($a -eq "white") {"The colour is white"} else {"Another colour"}
  • 39. Switch…… default Another method to run a specific set of code given specific conditions $a = "red" switch ($a) { "red" {"The colour is red"} "white"{"The colour is white"} default{"Another colour"} }
  • 40. ForEach ( Foreach-Object ) Loop through a collection of objects Foreach ($i in Get-Childitem c:windows) {$i.name; $i.creationtime}
  • 41. For Repeat the same steps a specific number of times For ($a=1; $a –le 10; $a++) {$a}
  • 42. While, do while, do until Do While Loop Can repeat a set of commands while a condition is met $a=1 Do {$a; $a++} While ($a –lt 10) Do Until Loop Can repeat a set of commands until a condition is met $a=1 Do {$a; $a++} Until ($a –gt 10)
  • 43. Break; Continue • For ($i = 1; $i -le 10; $i++) { Write-Host $i If ($i -eq 5) { Write-Host "BREAK!!“ Break } } • ForEach ($i in 1..10) { If ($i % 2) { Continue } $i }
  • 45. DEMO
  • 46. • [void] [reflection.assembly]::LoadWithPartialName("System.Windows.Forms") • $form = new-object Windows.Forms.Form • $form.Text = "My First Form" • $button = new-object Windows.Forms.Button • $button.text=“Çözümpark Tıklayın!" • $button.Dock="fill" • $button.add_click({$form.close()}) • $form.controls.add($button) • $form.Add_Shown({$form.Activate()}) • $form.ShowDialog() Form Uygulaması - Hello World
  • 47. • PS1 – Windows PowerShell shell script powershell.exe –noexit &”c:myscript.ps1” • PS1XML – Windows PowerShell format and type definitions • PSC1 – Windows PowerShell console file • PSD1 – Windows PowerShell data file • PSM1 – Windows PowerShell module file File extensions
  • 49. • Microsoft is working on the next version of PowerShell • Installed by default on Windows Server 2008 R2 and Windows 7 • http://www.microsoft.com/downloads/details .aspx?FamilyID=60deac2b-975b-41e6-9fa0- c2fd6aa6bc89&displaylang=en PowerShell 2.0
  • 50. • PowerShell Remoting • Background Jobs • Transactions • ScriptCmdlets • Modules • Script Debugging • Eventing • Windows PowerShell Integrated Scripting Environment • Network File Transfer • New Cmdlets • New Operators • Exception Handling with Try-Catch-Finally PowerShell 2.0 Neler Getiriyor?
  • 51. Daha Fazla Bilgi İçin – Microsoft Press – Microsoft Windows PowerShell Step By Step – Manning – Windows PowerShell in Action – Sams – Windows PowerShell Unleashed – Sapien Press – Microsoft Windows PowerShell – TechNet - Scripting with Windows PowerShell – www.cozumpark.com – http://blogs.msdn.com/powershell.