PowerShell: een introductie

Post on 12-Jan-2016

55 views 0 download

description

PowerShell: een introductie. Jetze Mellema jetze.mellema@imara-ict.nl. 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

PowerShell: een introductie

Jetze Mellemajetze.mellema@imara-ict.nl

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

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

Stelling 3

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

PowerShell

Een introductie

Wat is PowerShell?

• Shell• Scripttaal

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.

Dus PowerShell is nieuw?

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

Cmdlets, de bouwblokken

• Werkwoord + zelfstandig naamwoord

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

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

Cmdlets, en dan?

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

Cmdlets, en dan?

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

Hoe vind ik mijn weg?

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

Demo

• Basics

Tekst of objecten?

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

• PowerShell draait “bovenop” .Net Framework

Een voorbeeld

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

Demo

• Tekst of objecten• Import

PowerShell Providers

• Provider maakt deel van systeem beschikbaar voor PowerShell

• Filesystem• Uniform navigeren

Providers

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

Providers

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

Werken met providers

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

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"

Modules

• PSSnapin:– PowerShell v1– C#

• Module– PowerShell v2– Functies, scripts

• Module importeren: nieuwe functionaliteit

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

powershell.exe -noexit -command import-module ActiveDirectory

Werken met modules

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

Werken met modules

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

Demo

• Modules

Scripts

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

Demo

• Scripts

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

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

Windows 8

Windows 8

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

En dan nog dit

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

En dan nog dit

• PowerShell ISE (PowerShell-ISE)

En dan nog dit

Hoe verder?

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

Vragen?

• jetze.mellema@imara-ict.nl• @JetzeMellema