PowerShell: een introductie

39
PowerShell: een introductie Jetze Mellema jetze.mellema@imara -ict.nl

description

PowerShell: een introductie. Jetze Mellema [email protected]. Over de auteur. Infrastructuur Consultant AD, Exchange, Office 365, etc. MVP Exchange Server PowerShell ervaringsdeskundige. Stellingen. Stelling 1. PowerShell is een hype, die waait wel weer over. Stelling 2. - PowerPoint PPT Presentation

Transcript of PowerShell: een introductie

Page 1: PowerShell: een introductie

PowerShell: een introductie

Jetze [email protected]

Page 2: PowerShell: een introductie

Over de auteur

• Infrastructuur Consultant• AD, Exchange, Office 365, etc.• MVP Exchange Server• PowerShell ervaringsdeskundige

Page 3: PowerShell: een introductie

Stellingen

Page 4: PowerShell: een introductie

Stelling 1

• PowerShell is een hype, die waait wel weer over

Page 5: PowerShell: een introductie

Stelling 2

• Ik beheer vooral Windows Server 2003, ik heb niets aan PowerShell

Page 6: PowerShell: een introductie

Stelling 3

• Zo’n ding bestaat altijd uit een werkwoord en zelfstandig naamwoord, ofzo…

Page 7: PowerShell: een introductie

PowerShell

Een introductie

Page 8: PowerShell: een introductie

Wat is PowerShell?

• Shell• Scripttaal

Page 9: PowerShell: een introductie

Waar komen we vandaan?

• sh, bash, ksh, csh• command.com– MS-DOS– Windows 95/98/Me

• cmd.exe– Windows NT 3.1 en hoger

• VBScript, Jscript, etc.

Page 10: PowerShell: een introductie

Dus PowerShell is nieuw?

• Aankondiging in 2003!• Vroeger: PowerShell v1• Nu: PowerShell v2• Binnenkort: PowerShell v3

Page 11: PowerShell: een introductie

Cmdlets, de bouwblokken

• Werkwoord + zelfstandig naamwoord

• Get-Process• Remove-ADuser• Stop-Service

• Piping (|) en redirection (< en >)

Page 12: PowerShell: een introductie

Cmdlets, en dan?

• Cmdlets, parameters en waardes:– Get-EventLog -LogName Application -Newest 5– Start-Service -Name VSS -Verbose– Set-Location d:\scripts

Page 13: PowerShell: een introductie

Cmdlets, en dan?

• Cmdlets, parameters en waardes:– Get-EventLog -LogName Application -Newest 5– Start-Service -Name VSS -Verbose– Set-Location d:\scripts

Page 14: PowerShell: een introductie

Hoe vind ik mijn weg?

• PowerShell v2: 410 cmdlets• Tab completion• Get-Help• Aliassen

Page 15: PowerShell: een introductie

Demo

• Basics

Page 16: PowerShell: een introductie

Tekst of objecten?

• Unix, DOS, NT shells: tekst• PowerShell: objecten

• PowerShell draait “bovenop” .Net Framework

Page 17: PowerShell: een introductie

Een voorbeeld

• Import-CSV• Import-CSV | foreach { doe iets }

Page 18: PowerShell: een introductie

Demo

• Tekst of objecten• Import

Page 19: PowerShell: een introductie

PowerShell Providers

• Provider maakt deel van systeem beschikbaar voor PowerShell

• Filesystem• Uniform navigeren

Page 20: PowerShell: een introductie

Providers

• Standaard providers– Filesystem (default)– Certificates– Environment– Function– Registry– Variables

Page 21: PowerShell: een introductie

Providers

• Active Directory• Exchange• DNS• SQL• BizTalk• IIS 7.0• SharePoint• …

Page 22: PowerShell: een introductie

Werken met providers

• Set-Location (cd, chdir, sl)• Get-ChildItem (dir, gci, ls)• Remove-Item (del, erase, rd, ri, rm, rmdir)

Page 23: PowerShell: een introductie

Providers

• Set-ItemProperty HKLM:\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters DisabledComponents 0xffffffff -type dword

• Set-Location SQLSERVER:\SQL\localhost\DEFAULT\Databases

• Get-ChildItem env:LOGONSERVER• Get-Item "ad:\CN=administrator,cn=users,DC=lab,DC=local"

Page 24: PowerShell: een introductie

Modules

• PSSnapin:– PowerShell v1– C#

• Module– PowerShell v2– Functies, scripts

• Module importeren: nieuwe functionaliteit

Page 25: PowerShell: een introductie

Werken met modules• %windir%\system32\WindowsPowerShell\v1.0\

powershell.exe -noexit -command import-module ActiveDirectory

Page 26: PowerShell: een introductie

Werken met modules

• %SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -NoExit -ImportSystemModules

Page 27: PowerShell: een introductie

Werken met modules

• Get-Module• Import-Module• Get-Module -ListAvailable | Import-Module

Page 28: PowerShell: een introductie

Demo

• Modules

Page 29: PowerShell: een introductie

Scripts

• Opslaan als .ps1• Functies• Commentaar• Begrijp wat je leent

Page 30: PowerShell: een introductie

Demo

• Scripts

Page 31: PowerShell: een introductie

Windows 8

• (Bijna) alles PowerShell!• Import-Module ADDSDeployment• Install-ADDSForest -CreateDNSDelegation:

$false -DatabasePath "C:\Windows\NTDS" -DomainMode "Win8" -DomainName "windows8.local" -DomainNetBIOSName "WINDOWS8" -ForestMode "Win8" -InstallDNS:$true -LogPath "C:\Windows\NTDS" -RebootOnCompletion:$true -SYSVOLPath "C:\Windows\SYSVOL" -Force:$true

Page 32: PowerShell: een introductie

Windows 8• AD CS Administration Cmdlets• AD CS Deployment Cmdlets• AD DS Administration Cmdlets• App Installation Cmdlets• AppLocker Cmdlets• Best Practices Analyzer Cmdlets• BranchCache Cmdlets• Cluster-Aware Updating Cmdlets• Deduplication Cmdlets• Direct Access Client Cmdlets• DISM Cmdlets• Failover Clusters Cmdlets• Hyper-V Cmdlets• International Settings Cmdlets• iSCSI Cmdlets• iSCSI Target Cmdlets• Microsoft Online Backup Cmdlets• MultiPath I/O (MPIO) Cmdlets

• Network Connectivity Status Cmdlets• Network Load Balancing Cmdlets• Net TCP/IP Cmdlets• PKI Client Cmdlets• Print Management Cmdlets• Remote Access Cmdlets• Server Manager Cmdlets• Storage Cmdlets• VAMT Cmdlets• Windows Data Access Components (WDAC)

Cmdlets• Web Server (IIS) Administration Cmdlets

Cmdlets• WHEA Cmdlets• Windows Assessment Services Cmdlets• Windows PowerShell Web Access Cmdlets• Windows Server Update Services (WSUS)

Cmdlets

Page 33: PowerShell: een introductie

Windows 8

Page 34: PowerShell: een introductie

Windows 8

• Autoloading van modules• Scheduled jobs• PowerShell workflow• PowerShell Web Access • Map Network Drives• …

Page 35: PowerShell: een introductie

En dan nog dit

• Import-Module ServerManager• Get-WindowsFeature• Add-WindowsFeature Telnet-Client

Page 36: PowerShell: een introductie

En dan nog dit

• PowerShell ISE (PowerShell-ISE)

Page 37: PowerShell: een introductie

En dan nog dit

Page 38: PowerShell: een introductie

Hoe verder?

• Doen!• Bronnen:– http://jeffwouters.nl/– http://macfacts.org/– http://blogs.msdn.com/b/powershell/– http://jetzemellema.blogspot.com/

Page 39: PowerShell: een introductie

Vragen?

[email protected]• @JetzeMellema