PowerShell for ConfigMgr 2012 SP1 9/2/2019 7:43 AM WCL407 PowerShell for ConfigMgr 2012 SP1 Matt Shadbolt Premier Field Engineer (PFE) Microsoft Corp © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
Agenda Three minute intro to PowerShell 9/2/2019 7:43 AM Agenda Three minute intro to PowerShell What is PowerShell? Why use PowerShell? How do we use it? PowerShell integration with ConfigMgr What’s required? How do I connect? What can we do? Demos 3 scenario based demos 5 bonus demos © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
Three minute intro to PowerShell 9/2/2019 7:43 AM Three minute intro to PowerShell © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
Why PowerShell? Prior to PowerShell, command line management of Windows was horrible (at best) Larger Windows based datacentres, required larger automation Common language across OS and applications Who wants to write VBScript or Batch?
What is PowerShell? Command Line/Scripting environment from Microsoft Designed from scratch for the modern Windows OS Used to automate common administrative functions Extendable (ConfigMgr, Exchange, Active Directory) Object Oriented language Leverages the .NET object model
How do we use PowerShell? Cmdlets are compiled .NET code They perform specific functions Verb-Noun implementation Get-Service Objects make things easy Verb Noun
Demo PowerShell Basics
Demo scripts: http://aka.ms/bf7b7c Key Cmdlets Get-Service Stop-Service Start-Service Demo scripts: http://aka.ms/bf7b7c
PowerShell integration with ConfigMgr 9/2/2019 7:43 AM PowerShell integration with ConfigMgr © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
What’s Required? PowerShell 3.0 Configuration Manager 2012 SP1 Console Windows 7 SP1 + Windows Server 2008 SP2 + Microsoft .NET Framework 4 WS-Management 3.0 Windows Management Instrumentation (WMI) 3.0 Common Language Runtime 4.0 (Basically install the Windows Management Framework (WMF) 3.0 on your Windows 7 PC and you’re good to go!) Configuration Manager 2012 SP1 Console Cumulative 2 Update
How do I connect? Add the ConfigMgr module Import-Module "C:\Program Files (x86)\Microsoft Configuration Manager\AdminConsole\bin\ConfigurationManager.psd1" Connect to the Central or Primary Site Set-Location XXX:\ (where XXX is the Site Code) Test the connection Get-CMSite
What can I do? Most functions that can be done via the console, can be done via PowerShell Cmdlets start with CM (Get-CMSite, Set-CMBoundary) Technet list of Cmdlets http://aka.ms/ConfigMgrCmdlets List Cmdlets via PowerShell Get-Command –Module ConfigurationManager
Demo Connecting
Demo scripts: http://aka.ms/pb6sbx Key Cmdlets Import-Module Set-Location Get-CMSite Get-Command –Module ConfigurationManager Demo scripts: http://aka.ms/pb6sbx
9/2/2019 7:43 AM Scenario demos © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
Demo Collections
Demo scripts: http://aka.ms/Xq09ps Key Cmdlets New-CMDeviceCollection Add-CMDeviceCollectionQueryMembershipRule Demo scripts: http://aka.ms/Xq09ps
Demo Packages
Demo scripts: http://aka.ms/Khmrnv Key Cmdlets New-CMPackage New-CMProgram Start-CMContentDistribution New-CMDeviceCollection Start-CMPackageDeployment Demo scripts: http://aka.ms/Khmrnv
Demo App Approval
Demo scripts: http://aka.ms/Sr6m82 Key Cmdlets Get-CMApprovalRequests Approve-CMApprovalRequest Deny-CMApprovalRequest Demo scripts: http://aka.ms/Sr6m82
Demo Five short demos in five minutes
Demo scripts: http://aka.ms/Esmluw Key Cmdlets Get-CMBootImage Get-CMDriver Lock-CMObject Get-CMDeviceCollection Clear-CMPxeDeployment Get-CMBoundary Demo scripts: http://aka.ms/Esmluw
9/2/2019 7:43 AM Finishing Up http://blogs.technet.com/b/ConfigMgrDogs for all content and scripts from today http://blogs.technet.com/b/mspfe © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
9/2/2019 7:43 AM Related content Complex Maintenance Using System Centre 2012 Configuration Manager and Orchestrator - Patching Clusters! MDC317B PowerShell Demo Extravaganza MDC323 Find Me Later At... © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
Resources Learning TechNet Developer Network 9/2/2019 7:43 AM Resources Learning Sessions on Demand http://channel9.msdn.com/Events/TechEd/Australia/2013 Virtual Academy http://www.microsoftvirtualacademy.com/ TechNet Developer Network Resources for IT Professionals http://technet.microsoft.com/en-au/ Resources for Developers http://msdn.microsoft.com/en-au/ © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
9/2/2019 7:43 AM © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION. © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.