• Save

Loading…

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

Like this presentation? Why not share!

Like this? Share it with your network

Share

Windows Server 2008 (PowerShell Scripting Uygulamaları)

on

  • 3,174 views

Windows Server 2008 (PowerShell Scripting Uygulamaları)

Windows Server 2008 (PowerShell Scripting Uygulamaları)

Statistics

Views

Total Views
3,174
Views on SlideShare
3,066
Embed Views
108

Actions

Likes
1
Downloads
2
Comments
0

1 Embed 108

http://www.hakanuzuner.com 108

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Windows Server 2008 (PowerShell Scripting Uygulamaları) Presentation Transcript

  • 1. { PowerShell Scripting Uygulamaları } Mesut ALADAĞ Teknoloji Direktörü / MCT [email_address] 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
  • 3. PowerShell Nedir?
  • 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/technologies/management/powershell/download.mspx
    PowerShell Kurulumu-II
  • 6. PowerShell Kurulumu-III
  • 7. PowerShell Başlatılması
  • 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.
  • 10. CMDLETS Verb Noun Command
  • 11. Exchange 2007’den bir örnek 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
  • 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. MMC 3.0 Layered Over Windows PowerShell Command Line GUI Layered Over Your Application To Manage Windows PowerShell Engine Custom Application Microsoft Management Console 3.0 PSObject Windows PowerShell Cmdlets Windows Forms Early Bound Objects
  • 20. E2007Management Architecture PowerShell Engine Exchange cmdlets Configuration Data Access AD Registry Meta base MAPI Store Process boundary 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 = &quot;white&quot;
    • if ($a -eq &quot;red&quot;)
    • {&quot;The colour is red&quot;}
    • elseif ($a -eq &quot;white&quot;)
    • {&quot;The colour is white&quot;}
    • else
    • {&quot;Another colour&quot;}
  • 39. Switch…… default
    • Another method to run a specific set of code given specific conditions
    • $a = &quot;red&quot;
    • switch ($a)
    • {
    • &quot;red&quot; {&quot;The colour is red&quot;}
    • &quot;white&quot;{&quot;The colour is white&quot;}
    • default{&quot;Another colour&quot;}
    • }
  • 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 &quot;BREAK!!“
    • Break } }
    • ForEach ($i in 1..10) {
    • If ($i % 2) {
    • Continue }
    • $i }
  • 44. Reduced Complexity
  • 45. DEMO
  • 46.
    • [void][reflection.assembly]::LoadWithPartialName(&quot;System.Windows.Forms&quot;)
    • $form = new-object Windows.Forms.Form
    • $form.Text = &quot;My First Form&quot;
    • $button = new-object Windows.Forms.Button
    • $button.text=“ Çözümpark Tıklayın !&quot;
    • $button.Dock=&quot;fill&quot;
    • $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
  • 48.
    • http://blogs.msdn.com/powershell/attachment/1561580.ashx
    PowerShell Cheat Sheet
  • 49.
    • Microsoft is working on the next version of PowerShell
    • I nstalled 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 .
  • 52.
    • Sorularınız ?
  • 53.
    • Teşekkürler
    www.cozumpark.com | www.mesutaladag.com Mesut ALADAĞ Teknoloji Direktörü / MCT [email_address]