Powershell@MSUGS - Full Power AzureAzure, Sharepoint. The Shell 6 Powershell@MSUGS Powershell.exe...
Transcript of Powershell@MSUGS - Full Power AzureAzure, Sharepoint. The Shell 6 Powershell@MSUGS Powershell.exe...
![Page 1: Powershell@MSUGS - Full Power AzureAzure, Sharepoint. The Shell 6 Powershell@MSUGS Powershell.exe ISE. Basics 7 Powershell@MSUGS Verb-NounCommandlets Get-Process Get-NetFirewallProfile](https://reader034.fdocuments.net/reader034/viewer/2022042407/5f218a330471711893037fef/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
[email protected] MSUGSManuel Meyer, Trivadis AG
![Page 2: Powershell@MSUGS - Full Power AzureAzure, Sharepoint. The Shell 6 Powershell@MSUGS Powershell.exe ISE. Basics 7 Powershell@MSUGS Verb-NounCommandlets Get-Process Get-NetFirewallProfile](https://reader034.fdocuments.net/reader034/viewer/2022042407/5f218a330471711893037fef/html5/thumbnails/2.jpg)
BASEL BERN BRUGG DÜSSELDORF FRANKFURT A.M. FREIBURG I.BR. GENF
HAMBURG KOPENHAGEN LAUSANNE MÜNCHEN STUTTGART WIEN ZÜRICH
[email protected] MSUGSManuel Meyer, Trivadis AG
![Page 3: Powershell@MSUGS - Full Power AzureAzure, Sharepoint. The Shell 6 Powershell@MSUGS Powershell.exe ISE. Basics 7 Powershell@MSUGS Verb-NounCommandlets Get-Process Get-NetFirewallProfile](https://reader034.fdocuments.net/reader034/viewer/2022042407/5f218a330471711893037fef/html5/thumbnails/3.jpg)
Agenda
Powershell@MSUGS3
1. Basic PSKey FeaturesMy First Script
2. Advanced PSWMI / COM / .NET
3. PS IntegrationWindows / IIS / SQL Server / TFS / Azure / Sharepoint
4. Real Life PowershellTurtle, PSI, System Checker.
![Page 4: Powershell@MSUGS - Full Power AzureAzure, Sharepoint. The Shell 6 Powershell@MSUGS Powershell.exe ISE. Basics 7 Powershell@MSUGS Verb-NounCommandlets Get-Process Get-NetFirewallProfile](https://reader034.fdocuments.net/reader034/viewer/2022042407/5f218a330471711893037fef/html5/thumbnails/4.jpg)
Powershell@MSUGS4
Powershell Basics
![Page 5: Powershell@MSUGS - Full Power AzureAzure, Sharepoint. The Shell 6 Powershell@MSUGS Powershell.exe ISE. Basics 7 Powershell@MSUGS Verb-NounCommandlets Get-Process Get-NetFirewallProfile](https://reader034.fdocuments.net/reader034/viewer/2022042407/5f218a330471711893037fef/html5/thumbnails/5.jpg)
Key Features
Powershell@MSUGS5
Automation
PS Remoting
PS Workflow
.NET, COM, WMI, Perfcounters, EventLog, etc.
Integration in Products
–Windows, IIS, SQL Server, TFS, Microsoft Azure, Sharepoint.
![Page 6: Powershell@MSUGS - Full Power AzureAzure, Sharepoint. The Shell 6 Powershell@MSUGS Powershell.exe ISE. Basics 7 Powershell@MSUGS Verb-NounCommandlets Get-Process Get-NetFirewallProfile](https://reader034.fdocuments.net/reader034/viewer/2022042407/5f218a330471711893037fef/html5/thumbnails/6.jpg)
The Shell
Powershell@MSUGS6
Powershell.exe
ISE
![Page 7: Powershell@MSUGS - Full Power AzureAzure, Sharepoint. The Shell 6 Powershell@MSUGS Powershell.exe ISE. Basics 7 Powershell@MSUGS Verb-NounCommandlets Get-Process Get-NetFirewallProfile](https://reader034.fdocuments.net/reader034/viewer/2022042407/5f218a330471711893037fef/html5/thumbnails/7.jpg)
Basics
Powershell@MSUGS7
Verb-Noun Commandlets
Get-ProcessGet-NetFirewallProfile
Set-AclSet-AuthenticodeSignature
Add-PhysicalDiskRemove-BitLockerKeyProtector
Show-EventLog
![Page 8: Powershell@MSUGS - Full Power AzureAzure, Sharepoint. The Shell 6 Powershell@MSUGS Powershell.exe ISE. Basics 7 Powershell@MSUGS Verb-NounCommandlets Get-Process Get-NetFirewallProfile](https://reader034.fdocuments.net/reader034/viewer/2022042407/5f218a330471711893037fef/html5/thumbnails/8.jpg)
Basics
Powershell@MSUGS8
Help
Objects
Pipelining
Output
![Page 9: Powershell@MSUGS - Full Power AzureAzure, Sharepoint. The Shell 6 Powershell@MSUGS Powershell.exe ISE. Basics 7 Powershell@MSUGS Verb-NounCommandlets Get-Process Get-NetFirewallProfile](https://reader034.fdocuments.net/reader034/viewer/2022042407/5f218a330471711893037fef/html5/thumbnails/9.jpg)
More Basics
Powershell@MSUGS9
Comparison: -eq, -ne, -lt, -gt, -le, -ge, -contains, -notcontains
Arrays, HashTables
If-else, switch
For, foreach, while, do-while
Functions
![Page 10: Powershell@MSUGS - Full Power AzureAzure, Sharepoint. The Shell 6 Powershell@MSUGS Powershell.exe ISE. Basics 7 Powershell@MSUGS Verb-NounCommandlets Get-Process Get-NetFirewallProfile](https://reader034.fdocuments.net/reader034/viewer/2022042407/5f218a330471711893037fef/html5/thumbnails/10.jpg)
Bezeichnung Präsentation10
Advanced Powershell
![Page 11: Powershell@MSUGS - Full Power AzureAzure, Sharepoint. The Shell 6 Powershell@MSUGS Powershell.exe ISE. Basics 7 Powershell@MSUGS Verb-NounCommandlets Get-Process Get-NetFirewallProfile](https://reader034.fdocuments.net/reader034/viewer/2022042407/5f218a330471711893037fef/html5/thumbnails/11.jpg)
Basics: Providers
Powershell@MSUGS11
Get-PSProviders
–Environment
–FileSystem
–Function
–Registry
–Certificate
![Page 12: Powershell@MSUGS - Full Power AzureAzure, Sharepoint. The Shell 6 Powershell@MSUGS Powershell.exe ISE. Basics 7 Powershell@MSUGS Verb-NounCommandlets Get-Process Get-NetFirewallProfile](https://reader034.fdocuments.net/reader034/viewer/2022042407/5f218a330471711893037fef/html5/thumbnails/12.jpg)
Windows Management Instrumentation
(WMI)
Powershell@MSUGS12
“…a set of extensions to the Windows Driver Model that
provides an operating systeminterface…”
![Page 13: Powershell@MSUGS - Full Power AzureAzure, Sharepoint. The Shell 6 Powershell@MSUGS Powershell.exe ISE. Basics 7 Powershell@MSUGS Verb-NounCommandlets Get-Process Get-NetFirewallProfile](https://reader034.fdocuments.net/reader034/viewer/2022042407/5f218a330471711893037fef/html5/thumbnails/13.jpg)
COM Interop
Powershell@MSUGS13
Speech
Outlook.com Login
Excel Interop
![Page 14: Powershell@MSUGS - Full Power AzureAzure, Sharepoint. The Shell 6 Powershell@MSUGS Powershell.exe ISE. Basics 7 Powershell@MSUGS Verb-NounCommandlets Get-Process Get-NetFirewallProfile](https://reader034.fdocuments.net/reader034/viewer/2022042407/5f218a330471711893037fef/html5/thumbnails/14.jpg)
.NET
Powershell@MSUGS14
Acess any class from .NET
Load Assembly and Show UI
WPF Samples
Web Services
![Page 15: Powershell@MSUGS - Full Power AzureAzure, Sharepoint. The Shell 6 Powershell@MSUGS Powershell.exe ISE. Basics 7 Powershell@MSUGS Verb-NounCommandlets Get-Process Get-NetFirewallProfile](https://reader034.fdocuments.net/reader034/viewer/2022042407/5f218a330471711893037fef/html5/thumbnails/15.jpg)
PS Workflows
Powershell@MSUGS15
Based on .NET Workflow Foundation
Long-running, persistable
Interrupt, suspend, resume
Sequence, Parallel, Foreach, etc…
![Page 16: Powershell@MSUGS - Full Power AzureAzure, Sharepoint. The Shell 6 Powershell@MSUGS Powershell.exe ISE. Basics 7 Powershell@MSUGS Verb-NounCommandlets Get-Process Get-NetFirewallProfile](https://reader034.fdocuments.net/reader034/viewer/2022042407/5f218a330471711893037fef/html5/thumbnails/16.jpg)
Powershell@MSUGS16
PS Integration
![Page 17: Powershell@MSUGS - Full Power AzureAzure, Sharepoint. The Shell 6 Powershell@MSUGS Powershell.exe ISE. Basics 7 Powershell@MSUGS Verb-NounCommandlets Get-Process Get-NetFirewallProfile](https://reader034.fdocuments.net/reader034/viewer/2022042407/5f218a330471711893037fef/html5/thumbnails/17.jpg)
Working with Windows
17
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 18: Powershell@MSUGS - Full Power AzureAzure, Sharepoint. The Shell 6 Powershell@MSUGS Powershell.exe ISE. Basics 7 Powershell@MSUGS Verb-NounCommandlets Get-Process Get-NetFirewallProfile](https://reader034.fdocuments.net/reader034/viewer/2022042407/5f218a330471711893037fef/html5/thumbnails/18.jpg)
Working with Windows
18
Install-WindowsFeature-ConfigurationFilePathd:\WebServerConfigFile.xml
![Page 19: Powershell@MSUGS - Full Power AzureAzure, Sharepoint. The Shell 6 Powershell@MSUGS Powershell.exe ISE. Basics 7 Powershell@MSUGS Verb-NounCommandlets Get-Process Get-NetFirewallProfile](https://reader034.fdocuments.net/reader034/viewer/2022042407/5f218a330471711893037fef/html5/thumbnails/19.jpg)
Working with IIS
Powershell@MSUGS19
Import-Module WebAdministration
Add, change, remove
–Application pools
–Web Sites
–Virtual Directories
–Web Applications
–Website Bindings
Backup & Restore
–Web Configuration
![Page 20: Powershell@MSUGS - Full Power AzureAzure, Sharepoint. The Shell 6 Powershell@MSUGS Powershell.exe ISE. Basics 7 Powershell@MSUGS Verb-NounCommandlets Get-Process Get-NetFirewallProfile](https://reader034.fdocuments.net/reader034/viewer/2022042407/5f218a330471711893037fef/html5/thumbnails/20.jpg)
Working with SQL Server
Powershell@MSUGS20
Import-Module SQLPS or launch fromSSMS
Execute T-SQL
Backup & Restore DBs
Generate Scripts for DB, Tables, Procedures
![Page 21: Powershell@MSUGS - Full Power AzureAzure, Sharepoint. The Shell 6 Powershell@MSUGS Powershell.exe ISE. Basics 7 Powershell@MSUGS Verb-NounCommandlets Get-Process Get-NetFirewallProfile](https://reader034.fdocuments.net/reader034/viewer/2022042407/5f218a330471711893037fef/html5/thumbnails/21.jpg)
Working with TFS
Powershell@MSUGS21
Get info
–Work Items
–Source Control
Manage
–Workspaces
–Changesets, Shelvesets, Pending Changes
–Build Definitions
–…
![Page 22: Powershell@MSUGS - Full Power AzureAzure, Sharepoint. The Shell 6 Powershell@MSUGS Powershell.exe ISE. Basics 7 Powershell@MSUGS Verb-NounCommandlets Get-Process Get-NetFirewallProfile](https://reader034.fdocuments.net/reader034/viewer/2022042407/5f218a330471711893037fef/html5/thumbnails/22.jpg)
Working with Microsoft Azure
Powershell@MSUGS22
Manage
–Storeage
–VMs
–WebSites
–Resources
–Active Directory
–…
Create multi-tier IaaS environments
![Page 23: Powershell@MSUGS - Full Power AzureAzure, Sharepoint. The Shell 6 Powershell@MSUGS Powershell.exe ISE. Basics 7 Powershell@MSUGS Verb-NounCommandlets Get-Process Get-NetFirewallProfile](https://reader034.fdocuments.net/reader034/viewer/2022042407/5f218a330471711893037fef/html5/thumbnails/23.jpg)
Powershell@MSUGS23
![Page 24: Powershell@MSUGS - Full Power AzureAzure, Sharepoint. The Shell 6 Powershell@MSUGS Powershell.exe ISE. Basics 7 Powershell@MSUGS Verb-NounCommandlets Get-Process Get-NetFirewallProfile](https://reader034.fdocuments.net/reader034/viewer/2022042407/5f218a330471711893037fef/html5/thumbnails/24.jpg)
Working with Sharepoint
Powershell@MSUGS24
Install Sharepoint
Manage
–Site Collections
–Lists
–…
Import/Export
![Page 25: Powershell@MSUGS - Full Power AzureAzure, Sharepoint. The Shell 6 Powershell@MSUGS Powershell.exe ISE. Basics 7 Powershell@MSUGS Verb-NounCommandlets Get-Process Get-NetFirewallProfile](https://reader034.fdocuments.net/reader034/viewer/2022042407/5f218a330471711893037fef/html5/thumbnails/25.jpg)
Bezeichnung Präsentation25
Real Life Powershell
![Page 26: Powershell@MSUGS - Full Power AzureAzure, Sharepoint. The Shell 6 Powershell@MSUGS Powershell.exe ISE. Basics 7 Powershell@MSUGS Verb-NounCommandlets Get-Process Get-NetFirewallProfile](https://reader034.fdocuments.net/reader034/viewer/2022042407/5f218a330471711893037fef/html5/thumbnails/26.jpg)
Real Life Powershell
Powershell@MSUGS26
.NET Development
–CleanAllProjects.ps1
–PublishAll.ps1
–QueueDeploymentBuilds.ps1
–InstallAppServer.ps1
–InstallWebServer.ps1
![Page 27: Powershell@MSUGS - Full Power AzureAzure, Sharepoint. The Shell 6 Powershell@MSUGS Powershell.exe ISE. Basics 7 Powershell@MSUGS Verb-NounCommandlets Get-Process Get-NetFirewallProfile](https://reader034.fdocuments.net/reader034/viewer/2022042407/5f218a330471711893037fef/html5/thumbnails/27.jpg)
Real Life Powershell
Powershell@MSUGS27
Turtle
PSI
System Checker