Microsoft System Center PowerShell Essentials - Sample Chapter
Microsoft System Center PowerShell Essentials - Sample Chapter
P U B L I S H I N G
Harshul Patel
Sa
pl
e
P r o f e s s i o n a l
Guruprasad HP
ee
E x p e r t i s e
D i s t i l l e d
Guruprasad HP
Harshul Patel
P U B L I S H I N G
Harshul was one of the early Indian adopters of Windows PowerShell. He frequently
lectures on Windows PowerShell in user group gatherings and delivers training (mostly
on PowerShell) across various organizations. He is also a proud recipient of multiple
faculty awards and has received an innovation award from his employer. He is a core
member of the PowerShell Bangalore User Group
(
) and a member of the
New Delhi PowerShell User Group (
).
He can be contacted at
Harshul authored a book in 2013 named Instant Windows PowerShell Guide,
Packt Publishing (
).
[1]
We will also highlight how to use the various PowerShell cmdlets available with
these three product SDKs, along with their key tips and tricks. All guidance and
assistance will be provided to you on a high-level basis. Further exploration and
hands-on experience for these three products is required, so that you gain the most
out of this book.
[2]
Chapter 1
There are other examples of strong scripting languages, such as VBScript, Ruby,
Python, Perl, and so on, and administrators have adopted them too. VBScript became
popular because of the automation of routine, local administrator tasks, but the code
was a bit complex and hard to understand for novice users. Looking at Windows
PowerShell, we feel that the Microsoft team has worked hard to give us a powerful,
interactive scripting shell with an object-driven approach.
The important and exciting thing about this language is that it's a spitted object-based
output, which can be reused easily. It has pipeline and PSRemoting as its crucial
features, which put this language as the first priority while comparing it with other
scripting languages. Moreover, by following the Common Engineering Criteria
(CEC), Microsoft has decided that all future Microsoft products will come with
extensive Windows PowerShell support. This is also a good reason to learn and choose
Windows PowerShell. Additionally, PowerShell can be leveraged to use the massive
.Net Framework class functionality with most of the Microsoft products. We can also
achieve inventory and reporting by efficiently using the WMI functionality that lies
within PowerShell. A few Microsoft products support extensive functionality when
used with PowerShell; the best example is Exchange Server.
By default, Windows PowerShell 3.0 comes up with Windows Server 2012 and
Windows 8. There are a number of default modules present in this version. If you are
running an operating system lower than the ones specified in the preceding section,
you need to manually install Windows Management Framework 3.0, which is also
known as WMF 3.0.
If you have installed any previous releases of Windows Management
Framework, you must uninstall them before installing Windows
Management Framework 3.0.
Windows 7 SP1
Windows Server 2008 R2 SP1 (WMF 3.0 is also supported if you are running
Windows Server 2008 R2 as the server core)
[4]
Chapter 1
Microsoft .Net Framework 4.0: You can install Microsoft .Net Framework at
http://go.microsoft.com/fwlink/?LinkID=212547
In addition to the preceding software, you will need to meet the following requirements:
[5]
This will set the console location to the bin subfolder in the Configuration
[6]
Chapter 1
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:
[7]
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:
[8]
Chapter 1
[9]
5. This will set the console location to the PowerShell subfolder in the
Operations Manager Console installation folder.
6. Now, import the OperationsManger.psd1 module file by using the
Import-Module cmdlet:
PS C :\> Import-Module .\OperationsManager.psd1
[ 10 ]
Chapter 1
This will set the console location to the Service Manager subfolder in the
Service Manager Console installation folder.
6. Import the System.Center.Service.Manager.psd1 module file for SCSM
Management Servers by using the Import-Module cmdlet:
PS C :\> Import-Module .\System.Center.Service.Manager.psd1
[ 11 ]
7. Now you are ready to manage your Service Manager infrastructure for SCSM
Management Servers using Windows PowerShell.
8. Import the Microsoft.EnterpriseManagement.Warehouse.Cmdlets.psd1
module file for Data Warehouse Management Servers by using the ImportModule cmdlet:
PS C :\> Import-Module .\Microsoft.EnterpriseManagement.Warehouse.
Cmdlets.psd1
To confirm the successful import of the module, you can type the GetModule cmdlet on the PowerShell console. Now you will be able to see
the new module added to the System.Center.Service.Manager and
Microsoft.EnterpriseManagement.Warehouse.Cmdlets lists.
9. Now you are ready to manage your Service Manager infrastructure for Data
Warehouse Management Servers using Windows PowerShell.
Summary
By end of this introductory chapter, you should be able to understand the basic
terminology and setup requirement to use Windows PowerShell with several
System Center products.
Going ahead, we will specifically look at each of these products and try to explore
more functionalities that we can achieve using Windows PowerShell.
[ 12 ]
www.PacktPub.com
Stay Connected: