powershell für · agenda 1. powershell basics 2. advanced powershell remoting / wmi / com / .net...
TRANSCRIPT
![Page 1: Powershell für · Agenda 1. Powershell Basics 2. Advanced Powershell Remoting / WMI / COM / .NET 3. PS Integration Windows / IIS / SQL Server / TFS / Azure / Sharepoint](https://reader030.vdocuments.net/reader030/viewer/2022040608/5ec53f35320cc925d949c7a5/html5/thumbnails/1.jpg)
BASEL BERN BRUGG DÜSSELDORF FRANKFURT A.M. FREIBURG I.BR. GENF
HAMBURG KOPENHAGEN LAUSANNE MÜNCHEN STUTTGART WIEN ZÜRICH
Powershell für .NET07.04.2016 Trivadis Late Lounge
Manuel Meyer, Trivadis AG
www.manuelmeyer.net
@manumeyer1
![Page 2: Powershell für · Agenda 1. Powershell Basics 2. Advanced Powershell Remoting / WMI / COM / .NET 3. PS Integration Windows / IIS / SQL Server / TFS / Azure / Sharepoint](https://reader030.vdocuments.net/reader030/viewer/2022040608/5ec53f35320cc925d949c7a5/html5/thumbnails/2.jpg)
Agenda
1. Powershell Basics
2. Advanced PowershellRemoting / WMI / COM / .NET
3. PS IntegrationWindows / IIS / SQL Server / TFS / Azure / Sharepoint
4. Demo Twitter
![Page 3: Powershell für · Agenda 1. Powershell Basics 2. Advanced Powershell Remoting / WMI / COM / .NET 3. PS Integration Windows / IIS / SQL Server / TFS / Azure / Sharepoint](https://reader030.vdocuments.net/reader030/viewer/2022040608/5ec53f35320cc925d949c7a5/html5/thumbnails/3.jpg)
Powershell Basics
![Page 4: Powershell für · Agenda 1. Powershell Basics 2. Advanced Powershell Remoting / WMI / COM / .NET 3. PS Integration Windows / IIS / SQL Server / TFS / Azure / Sharepoint](https://reader030.vdocuments.net/reader030/viewer/2022040608/5ec53f35320cc925d949c7a5/html5/thumbnails/4.jpg)
Key Features
Automation
PS Remoting
PS Workflow
.NET, COM, WMI, Perfcounters, EventLog, etc.
Integration in Products
–Windows, IIS, SQL Server, TFS, Microsoft Azure, Sharepoint.
![Page 5: Powershell für · Agenda 1. Powershell Basics 2. Advanced Powershell Remoting / WMI / COM / .NET 3. PS Integration Windows / IIS / SQL Server / TFS / Azure / Sharepoint](https://reader030.vdocuments.net/reader030/viewer/2022040608/5ec53f35320cc925d949c7a5/html5/thumbnails/5.jpg)
The Shell
Powershell.exe
ISE
![Page 6: Powershell für · Agenda 1. Powershell Basics 2. Advanced Powershell Remoting / WMI / COM / .NET 3. PS Integration Windows / IIS / SQL Server / TFS / Azure / Sharepoint](https://reader030.vdocuments.net/reader030/viewer/2022040608/5ec53f35320cc925d949c7a5/html5/thumbnails/6.jpg)
Basics
Verb-Noun Commandlets
Get-ProcessGet-NetFirewallProfile
Set-AclSet-AuthenticodeSignature
Add-PhysicalDiskRemove-BitLockerKeyProtector
Show-EventLog
![Page 7: Powershell für · Agenda 1. Powershell Basics 2. Advanced Powershell Remoting / WMI / COM / .NET 3. PS Integration Windows / IIS / SQL Server / TFS / Azure / Sharepoint](https://reader030.vdocuments.net/reader030/viewer/2022040608/5ec53f35320cc925d949c7a5/html5/thumbnails/7.jpg)
Basics
Help
Objects
Pipelining
Output
![Page 8: Powershell für · Agenda 1. Powershell Basics 2. Advanced Powershell Remoting / WMI / COM / .NET 3. PS Integration Windows / IIS / SQL Server / TFS / Azure / Sharepoint](https://reader030.vdocuments.net/reader030/viewer/2022040608/5ec53f35320cc925d949c7a5/html5/thumbnails/8.jpg)
More Basics
Powershell@MSUGS
Comparison: -eq, -ne, -lt, -gt, -le, -ge, -contains, -notcontains
Arrays, HashTables
If-else, switch
For, foreach, while, do-while
Functions
![Page 9: Powershell für · Agenda 1. Powershell Basics 2. Advanced Powershell Remoting / WMI / COM / .NET 3. PS Integration Windows / IIS / SQL Server / TFS / Azure / Sharepoint](https://reader030.vdocuments.net/reader030/viewer/2022040608/5ec53f35320cc925d949c7a5/html5/thumbnails/9.jpg)
Demo Basics
![Page 10: Powershell für · Agenda 1. Powershell Basics 2. Advanced Powershell Remoting / WMI / COM / .NET 3. PS Integration Windows / IIS / SQL Server / TFS / Azure / Sharepoint](https://reader030.vdocuments.net/reader030/viewer/2022040608/5ec53f35320cc925d949c7a5/html5/thumbnails/10.jpg)
Advanced Powershell
![Page 11: Powershell für · Agenda 1. Powershell Basics 2. Advanced Powershell Remoting / WMI / COM / .NET 3. PS Integration Windows / IIS / SQL Server / TFS / Azure / Sharepoint](https://reader030.vdocuments.net/reader030/viewer/2022040608/5ec53f35320cc925d949c7a5/html5/thumbnails/11.jpg)
Powershell Remoting
Enter-PSSession
…-Computername LTMME02
Invoke-Command –Computername LTMME01, LTMME02, LTMME03 –Scriptblock { <cmd>}
![Page 12: Powershell für · Agenda 1. Powershell Basics 2. Advanced Powershell Remoting / WMI / COM / .NET 3. PS Integration Windows / IIS / SQL Server / TFS / Azure / Sharepoint](https://reader030.vdocuments.net/reader030/viewer/2022040608/5ec53f35320cc925d949c7a5/html5/thumbnails/12.jpg)
COM Interop
Speech
Excel Interop
![Page 13: Powershell für · Agenda 1. Powershell Basics 2. Advanced Powershell Remoting / WMI / COM / .NET 3. PS Integration Windows / IIS / SQL Server / TFS / Azure / Sharepoint](https://reader030.vdocuments.net/reader030/viewer/2022040608/5ec53f35320cc925d949c7a5/html5/thumbnails/13.jpg)
Windows Management Instrumentation
(WMI)
“…a set of extensions to the
Windows Driver Model that
provides an operating system
interface…”
![Page 14: Powershell für · Agenda 1. Powershell Basics 2. Advanced Powershell Remoting / WMI / COM / .NET 3. PS Integration Windows / IIS / SQL Server / TFS / Azure / Sharepoint](https://reader030.vdocuments.net/reader030/viewer/2022040608/5ec53f35320cc925d949c7a5/html5/thumbnails/14.jpg)
Basics: Providers
Get-PSProviders
–Environment
–FileSystem
–Function
–Registry
–Certificate
– IIS
–SqlServer
–…
![Page 15: Powershell für · Agenda 1. Powershell Basics 2. Advanced Powershell Remoting / WMI / COM / .NET 3. PS Integration Windows / IIS / SQL Server / TFS / Azure / Sharepoint](https://reader030.vdocuments.net/reader030/viewer/2022040608/5ec53f35320cc925d949c7a5/html5/thumbnails/15.jpg)
.NET
Powershell@MSUGS15
Acess any class from .NET
Web Services
Load Assembly and Show UI
WPF Samples
![Page 16: Powershell für · Agenda 1. Powershell Basics 2. Advanced Powershell Remoting / WMI / COM / .NET 3. PS Integration Windows / IIS / SQL Server / TFS / Azure / Sharepoint](https://reader030.vdocuments.net/reader030/viewer/2022040608/5ec53f35320cc925d949c7a5/html5/thumbnails/16.jpg)
PS Workflows
Based on .NET Workflow Foundation
Long-running, persistable
Interrupt, suspend, resume
Sequence, Parallel, Foreach, etc…
![Page 17: Powershell für · Agenda 1. Powershell Basics 2. Advanced Powershell Remoting / WMI / COM / .NET 3. PS Integration Windows / IIS / SQL Server / TFS / Azure / Sharepoint](https://reader030.vdocuments.net/reader030/viewer/2022040608/5ec53f35320cc925d949c7a5/html5/thumbnails/17.jpg)
PS Integration
![Page 18: Powershell für · Agenda 1. Powershell Basics 2. Advanced Powershell Remoting / WMI / COM / .NET 3. PS Integration Windows / IIS / SQL Server / TFS / Azure / Sharepoint](https://reader030.vdocuments.net/reader030/viewer/2022040608/5ec53f35320cc925d949c7a5/html5/thumbnails/18.jpg)
Working with Windows
Roles & Features
Get-WindowsFeature/Install-WindowsFeature/Uninstall-WindowsFeature
Install-WindowsFeature Web-Server-IncludeAllSubFeature -IncludeManagementTools
'WebSrv01', 'WebSrv02', 'WebSrv03'| ForEach-Object{Install-WindowsFeature Web-Server-IncludeAllSubFeature -IncludeManagementTools -ComputerName $_}
![Page 19: Powershell für · Agenda 1. Powershell Basics 2. Advanced Powershell Remoting / WMI / COM / .NET 3. PS Integration Windows / IIS / SQL Server / TFS / Azure / Sharepoint](https://reader030.vdocuments.net/reader030/viewer/2022040608/5ec53f35320cc925d949c7a5/html5/thumbnails/19.jpg)
Working with Windows
Install-WindowsFeature-ConfigurationFilePathd:\WebServerConfigFile.xml
![Page 20: Powershell für · Agenda 1. Powershell Basics 2. Advanced Powershell Remoting / WMI / COM / .NET 3. PS Integration Windows / IIS / SQL Server / TFS / Azure / Sharepoint](https://reader030.vdocuments.net/reader030/viewer/2022040608/5ec53f35320cc925d949c7a5/html5/thumbnails/20.jpg)
Working with IIS
Import-Module WebAdministration
Add, change, remove
–Application pools
–Web Sites
–Virtual Directories
–Web Applications
–Website Bindings
Backup & Restore
–Web Configuration
![Page 21: Powershell für · Agenda 1. Powershell Basics 2. Advanced Powershell Remoting / WMI / COM / .NET 3. PS Integration Windows / IIS / SQL Server / TFS / Azure / Sharepoint](https://reader030.vdocuments.net/reader030/viewer/2022040608/5ec53f35320cc925d949c7a5/html5/thumbnails/21.jpg)
Working with SQL Server
Import-Module SQLPS or launch fromSSMS
Execute T-SQL
Backup & Restore DBs
Generate Scripts for DB, Tables, Procedures
![Page 22: Powershell für · Agenda 1. Powershell Basics 2. Advanced Powershell Remoting / WMI / COM / .NET 3. PS Integration Windows / IIS / SQL Server / TFS / Azure / Sharepoint](https://reader030.vdocuments.net/reader030/viewer/2022040608/5ec53f35320cc925d949c7a5/html5/thumbnails/22.jpg)
Working with TFS
Get info
–Work Items
–Source Control
Manage
–Workspaces
–Changesets, Shelvesets, Pending Changes
–Build Definitions
–…
![Page 23: Powershell für · Agenda 1. Powershell Basics 2. Advanced Powershell Remoting / WMI / COM / .NET 3. PS Integration Windows / IIS / SQL Server / TFS / Azure / Sharepoint](https://reader030.vdocuments.net/reader030/viewer/2022040608/5ec53f35320cc925d949c7a5/html5/thumbnails/23.jpg)
Working with Sharepoint
Install Sharepoint
Manage
–Site Collections
–Lists
–…
Import/Export
![Page 24: Powershell für · Agenda 1. Powershell Basics 2. Advanced Powershell Remoting / WMI / COM / .NET 3. PS Integration Windows / IIS / SQL Server / TFS / Azure / Sharepoint](https://reader030.vdocuments.net/reader030/viewer/2022040608/5ec53f35320cc925d949c7a5/html5/thumbnails/24.jpg)
Working with Microsoft Azure
Manage
–Storeage
–VMs
–WebSites
–Resources
–Active Directory
–…
Create multi-tier IaaS environments
![Page 25: Powershell für · Agenda 1. Powershell Basics 2. Advanced Powershell Remoting / WMI / COM / .NET 3. PS Integration Windows / IIS / SQL Server / TFS / Azure / Sharepoint](https://reader030.vdocuments.net/reader030/viewer/2022040608/5ec53f35320cc925d949c7a5/html5/thumbnails/25.jpg)
![Page 26: Powershell für · Agenda 1. Powershell Basics 2. Advanced Powershell Remoting / WMI / COM / .NET 3. PS Integration Windows / IIS / SQL Server / TFS / Azure / Sharepoint](https://reader030.vdocuments.net/reader030/viewer/2022040608/5ec53f35320cc925d949c7a5/html5/thumbnails/26.jpg)
Demo KUDU
![Page 27: Powershell für · Agenda 1. Powershell Basics 2. Advanced Powershell Remoting / WMI / COM / .NET 3. PS Integration Windows / IIS / SQL Server / TFS / Azure / Sharepoint](https://reader030.vdocuments.net/reader030/viewer/2022040608/5ec53f35320cc925d949c7a5/html5/thumbnails/27.jpg)
![Page 28: Powershell für · Agenda 1. Powershell Basics 2. Advanced Powershell Remoting / WMI / COM / .NET 3. PS Integration Windows / IIS / SQL Server / TFS / Azure / Sharepoint](https://reader030.vdocuments.net/reader030/viewer/2022040608/5ec53f35320cc925d949c7a5/html5/thumbnails/28.jpg)
Bezeichnung Präsentation28
Demo Twitter