Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Microsoft System Center Powershell Essentials

You're reading from   Microsoft System Center Powershell Essentials Efficiently administer, automate, and manage System Center environments using Windows PowerShell

Arrow left icon
Product type Paperback
Published in Apr 2015
Publisher Packt
ISBN-13 9781784397142
Length 140 pages
Edition 1st Edition
Arrow right icon
Toc

Table of Contents (10) Chapters Close

Preface 1. Setting up the Environment to Use PowerShell 2. Administration of Configuration Manager through PowerShell FREE CHAPTER 3. Scenario-based Scripting for SCCM Administration 4. Administration of Operations Manager through PowerShell 5. Scenario-based Scripting for SCOM Administration 6. Administration of Service Manager through PowerShell 7. Scenario-based Scripting for SCSM Administration 8. Best Practices Index

Setting up the System Center Configuration Manager environment

This section talks about how to setup your Windows PowerShell console to start with the SCCM activities. The traditional method of importing the SCCM module in Windows PowerShell is supported by SCCM 2007 and its later versions.

The prerequisites to set up SCCM are as follows:

  • SCCM 2007 or its later version infrastructure
  • Windows PowerShell 2.0 or its later version

Connecting to Windows PowerShell for SCCM

The steps for connecting to Windows PowerShell for SCCM are as follows:

  1. Start the 32-bit Windows PowerShell console from your operating system box, as the SCCM infrastructure is only supported with the 32-bit PowerShell architecture.
  2. If you are using Windows Server 2008 R2 or a similar operating system, then you can click on Start, search for Windows PowerShell (x86), and launch the console.

    If you are using Windows Server 2012 or a similar operating system, then you can press the Windows key + F, search for Windows PowerShell, and choose Apps in the console. From the search list, select Windows PowerShell (x86) and launch the console.

    Connecting to Windows PowerShell for SCCM
  3. To import the Configuration Manager PowerShell module, we need to change the console location to the Configuration Manager Installation folder. For example, we will refer to the parent installation folder as C:\Program Files(x86).
  4. Type the following lines into the PowerShell console:
    PS C :\> cd "C:\Program Files(x86)\Microsoft Configuration Manager\AdminConsole\bin"
    

    This will set the console location to the bin subfolder in the Configuration Manager Installation folder.

  5. Now, import the ConfigurationManger.psd1 module file by using the Import-Module cmdlet:
    PS C :\> Import-Module .\ConfigurationManager.psd1
    

    Note

    To confirm the successful import of the module, you can type Get-Module CMDLET in the PowerShell console. Now you will be able to see the new module added to the ConfigurationManager list.

  6. After successfully importing the module file, set the console location to your site location by using your site code. For example, we have taken ABC site code in the following command statement:
    PS C :\> Set-Location ABC:
    

    The Configuration Manager PowerShell module also includes PowerShell Driver Provider for Configuration Manager Sites. For example, if you have a central site administration, site ABC and two primary sites PS1 and PS2, then you can change the connection context like this:

    PS C :\> Set-Location ABC:
    PS C :\> Set-Location PS1:
    PS C :\> Set-Location PS2:
    

    Note

    If you don't change the connection context, then you can't manage the Configuration Manager Site as well.

  7. Now you are ready to manage your Configuration Manager infrastructure using Windows PowerShell.

Tip

Downloading the example code

You can download the example code files from your account at http://www.packtpub.com for all the Packt Publishing books you have purchased. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

There is also another simple method available to connect SCCM using PowerShell with the latest releases of SCCM 2012 and so on. The prerequisites for that are as follows:

  • System Center Configuration Manager 2012 SP1 RTM or a later version infrastructure
  • Windows Server 2012 or Windows Server 2008 R2 with WMF 3.0

Connecting to Windows PowerShell from the SCCM console

The steps for connecting to Windows PowerShell from the SCCM console are as follows:

  1. Press the Windows key + F, search for Configuration Manager, and choose Apps. From the search list, select Configuration Manager Console and launch the console.
    Connecting to Windows PowerShell from the SCCM console
  2. In the Configuration Manager Console, click on the upper-left corner of the console and select Connect via Windows PowerShell.
    Connecting to Windows PowerShell from the SCCM console
  3. The Configuration Manager then imports the PowerShell module automatically.
  4. Now you are ready to manage your Configuration Manager infrastructure using the Windows PowerShell console.
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at £16.99/month. Cancel anytime