powershell dsc oliver ryf - digiblog.s3-eu-central-1...

17
Digicomp Microsoft Evolution Day 2015 1 Powershell DSC Oliver Ryf Partner:

Upload: others

Post on 06-Sep-2019

14 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Powershell DSC Oliver Ryf - digiblog.s3-eu-central-1 ...digiblog.s3-eu-central-1.amazonaws.com/...powershell-dsc_oliver-ryf.pdf · Digicomp Microsoft Evolution Day 2015 3 Vorstellung

Digicomp Microsoft Evolution Day 2015 1

Powershell DSC

Oliver Ryf

Partner:

Page 2: Powershell DSC Oliver Ryf - digiblog.s3-eu-central-1 ...digiblog.s3-eu-central-1.amazonaws.com/...powershell-dsc_oliver-ryf.pdf · Digicomp Microsoft Evolution Day 2015 3 Vorstellung

2Digicomp Microsoft Evolution Day 2015

Agenda

Begrüssung

Vorstellung Referent

PowerShell Desired State Configuration

F&A

Weiterführende Kurse

Page 3: Powershell DSC Oliver Ryf - digiblog.s3-eu-central-1 ...digiblog.s3-eu-central-1.amazonaws.com/...powershell-dsc_oliver-ryf.pdf · Digicomp Microsoft Evolution Day 2015 3 Vorstellung

3Digicomp Microsoft Evolution Day 2015

Vorstellung Referent

Seit 1991 IT-Trainer

1995 MCSE und MCT

Seit 2000 diverse Projekte im Bereich Windows/Office Migrationen, Active Directory, Infratruktur, Hyper-V und Azure Cloud

Seit 2006 Trainer bei Digicomp

Seit 2014 Principal Consultant und Cloud Archiect bei UP-Great AG Fehraltorf

Page 4: Powershell DSC Oliver Ryf - digiblog.s3-eu-central-1 ...digiblog.s3-eu-central-1.amazonaws.com/...powershell-dsc_oliver-ryf.pdf · Digicomp Microsoft Evolution Day 2015 3 Vorstellung

4Digicomp Microsoft Evolution Day 2015

Was ist PowerShell DSC

Teil des Windows Management Framework ab Version 4

Erweiterung von PowerShell für das Management von Systemen, welche PowerShell 5 unterstützen

DSC unterstützt Sie bei:

Deployments

Automation

Konfigurationen

Compliance Checks

Page 5: Powershell DSC Oliver Ryf - digiblog.s3-eu-central-1 ...digiblog.s3-eu-central-1.amazonaws.com/...powershell-dsc_oliver-ryf.pdf · Digicomp Microsoft Evolution Day 2015 3 Vorstellung

5Digicomp Microsoft Evolution Day 2015

Ausgangslage

Sie installieren einen neuen Client oder Server…

Welche Schritte erledigen Sie mit welchen Werkzeugen?

Manuelle Anpassungen z.B. der Oberfläche, in der Registry, Dateien kopieren

Hinzufügen von Features (z.B. IIS)

Konfiguration der Features

Installation von Softwarepaketen

Page 6: Powershell DSC Oliver Ryf - digiblog.s3-eu-central-1 ...digiblog.s3-eu-central-1.amazonaws.com/...powershell-dsc_oliver-ryf.pdf · Digicomp Microsoft Evolution Day 2015 3 Vorstellung

6Digicomp Microsoft Evolution Day 2015

Wie kann ich das Automatisieren?

Images

Relativ unflexibel

Scripts

Ja schon, aber…

Group Policies

Wo sind die Grenzen und entspricht wirklich jeder Server meinen Anforderungen

Softwareverteilung

Nur ein kleiner Teil der Anpassungen

Was noch?

Page 7: Powershell DSC Oliver Ryf - digiblog.s3-eu-central-1 ...digiblog.s3-eu-central-1.amazonaws.com/...powershell-dsc_oliver-ryf.pdf · Digicomp Microsoft Evolution Day 2015 3 Vorstellung

7Digicomp Microsoft Evolution Day 2015

Und noch wichtiger!

Wie kann ich gewährleisten, dass niemand die Konfiguration geändert hat???

Page 8: Powershell DSC Oliver Ryf - digiblog.s3-eu-central-1 ...digiblog.s3-eu-central-1.amazonaws.com/...powershell-dsc_oliver-ryf.pdf · Digicomp Microsoft Evolution Day 2015 3 Vorstellung

8Digicomp Microsoft Evolution Day 2015

DSC – Die Lösung für alles

Mit PowerShell DSC beschreibe ich:

wo und ob Verzeichnisse oder Dateien vorhanden sein sollen,

welche Windows Rollen und Features aktiviert sind,

welche Software installiert

Gruppen und User vorhanden sein sollen.

etc.

By the way…

Es funktioniert auch mit LINUX!

Page 9: Powershell DSC Oliver Ryf - digiblog.s3-eu-central-1 ...digiblog.s3-eu-central-1.amazonaws.com/...powershell-dsc_oliver-ryf.pdf · Digicomp Microsoft Evolution Day 2015 3 Vorstellung

9Digicomp Microsoft Evolution Day 2015

Voraussetzungen

DSC verwendet CIM und den WinRM Service und Listeners für Remoting

Configuring Remoting for DSC

Enable-PSRemoting

Script execution policy muss das Ausführen von Scripts zulassen

Page 10: Powershell DSC Oliver Ryf - digiblog.s3-eu-central-1 ...digiblog.s3-eu-central-1.amazonaws.com/...powershell-dsc_oliver-ryf.pdf · Digicomp Microsoft Evolution Day 2015 3 Vorstellung

10Digicomp Microsoft Evolution Day 2015

DSC Resoure Providers und Properties

Die Resource Providers beschreiben, wie mit Hilfe von DSC einzelne Objekte, oder Ressourcen konfiguriert werden können

DSC stellt In-the-Box Resource Providers zur Verfügung

Über die PowerShell Gallery (www.powershellgallery.com) können weitere DSC Resource Provider automatisch geladen werden

Find-Module

Install-Module

Zudem können eigene Resource Provider selber geschrieben werden

Page 11: Powershell DSC Oliver Ryf - digiblog.s3-eu-central-1 ...digiblog.s3-eu-central-1.amazonaws.com/...powershell-dsc_oliver-ryf.pdf · Digicomp Microsoft Evolution Day 2015 3 Vorstellung

11Digicomp Microsoft Evolution Day 2015

Standard DSC Resource ProviderProvider Description

DSC Archive Resource Unpacks archive (.zip) files at specific paths on target nodes.

DSC Environment Resource Manages system environment variables on target nodes.

DSC File Resource Manages files and directories on target nodes.

DSC Group Resource Manages local groups on target nodes.

DSC Log Resource Logs configuration messages.

DSC Package Resource Installs and manages packages, such as Windows Installer and setup.exe packages, on target nodes.

DSC WindowsProcess Resource Configures Windows processes on target nodes.

DSC Registry Resource Manages registry keys and values on target nodes.

DSC WindowsFeature Resource Adds or removes Windows features and roles on target nodes.

DSC Script Resource Runs Windows PowerShell script blocks on target nodes.

DSC Service Resource Manages services on target nodes.

DSC User Resource Manages local user accounts on target nodes.

Page 12: Powershell DSC Oliver Ryf - digiblog.s3-eu-central-1 ...digiblog.s3-eu-central-1.amazonaws.com/...powershell-dsc_oliver-ryf.pdf · Digicomp Microsoft Evolution Day 2015 3 Vorstellung

12Digicomp Microsoft Evolution Day 2015

DEMO

Page 13: Powershell DSC Oliver Ryf - digiblog.s3-eu-central-1 ...digiblog.s3-eu-central-1.amazonaws.com/...powershell-dsc_oliver-ryf.pdf · Digicomp Microsoft Evolution Day 2015 3 Vorstellung

13Digicomp Microsoft Evolution Day 2015

Überwachen

Die Überwachung Ihrer Konfiguration übernimmt der Local Configuration Manager (LCM)

Standardmässig schreibt der LCM Abweichungen lediglich in ein LOG-File

Get-DscLocalConfigurationManager

«ApplyAndMonitor»

Page 14: Powershell DSC Oliver Ryf - digiblog.s3-eu-central-1 ...digiblog.s3-eu-central-1.amazonaws.com/...powershell-dsc_oliver-ryf.pdf · Digicomp Microsoft Evolution Day 2015 3 Vorstellung

14Digicomp Microsoft Evolution Day 2015

Überwachen und Korrigieren

Configuration MyLCMConfig{

Param([string]$ComputerName)node ($ComputerName){

LocalConfigurationManager{

ConfigurationMode = "ApplyAndAutoCorrect" # it will fix - reapply the DSCConfigurationModeFrequencyMins = 30 # there is no lower valueRebootNodeIfNeeded = 'True'RefreshFrequencyMins = 15

}}

}

MyLCMConfig -OutputPath "C:\myDSC" -ComputerName localhost

Set-DscLocalConfigurationManager -Path "C:\myDSC"

Page 15: Powershell DSC Oliver Ryf - digiblog.s3-eu-central-1 ...digiblog.s3-eu-central-1.amazonaws.com/...powershell-dsc_oliver-ryf.pdf · Digicomp Microsoft Evolution Day 2015 3 Vorstellung

15Digicomp Microsoft Evolution Day 2015

Push oder Pull

Page 16: Powershell DSC Oliver Ryf - digiblog.s3-eu-central-1 ...digiblog.s3-eu-central-1.amazonaws.com/...powershell-dsc_oliver-ryf.pdf · Digicomp Microsoft Evolution Day 2015 3 Vorstellung

16Digicomp Microsoft Evolution Day 2015

F&A

Page 17: Powershell DSC Oliver Ryf - digiblog.s3-eu-central-1 ...digiblog.s3-eu-central-1.amazonaws.com/...powershell-dsc_oliver-ryf.pdf · Digicomp Microsoft Evolution Day 2015 3 Vorstellung

17Digicomp Microsoft Evolution Day 2015

Weiterführende Kurse

Fortgeschrittener PowerShell Workshop («PWF»)

Firmenspezifische Workshops