PowerShell/Systems Management

This lesson introduces PowerShell systems management using Windows Management Instrumentation (WMI), Remote WMI, and PowerShell Remoting.

Objectives and Skills
After completing this lesson, you will be able to:
 * Describe basic PowerShell WMI concepts.
 * Create PowerShell scripts to process WMI content.
 * Use PowerShell Remoting to run commands on a remote computer.

Readings

 * 1)  Systems management
 * 2)  Windows Management Instrumentation
 * 3) BonusBits: Mastering PowerShell Chapter 18 - WMI
 * 4) Windows IT Pro: PowerShell Basics: Remote Management

Multimedia

 * 1) YouTube: WMI and PowerShell

Get-WmiObject List
The Get-WmiObject cmdlet gets instances of WMI classes or information about the available WMI classes.

Win32_BIOS
The Win32_BIOS WMI class represents the attributes of the computer system's basic input/output services (BIOS) that are installed on a computer.

Win32_ComputerSystem
The Win32_ComputerSystem class represents a computer system operating in a Windows environment. Example output: Domain             : MY_DOMAIN_NAME Manufacturer       : MY_COMPUTER_Manufacturer_Inc. Model              : My_Model Name               : My_Computer_name PrimaryOwnerName   : TotalPhysicalMemory : 17024573440

Win32_NetworkAdapterConfiguration
The Win32_NetworkAdapterConfiguration class represents the attributes and behaviors of a network adapter.

win32_logicaldisk
The win32_logicaldisk class presents information about logicaldisks, size and free space available.

Get-PSDrive command can also be used to obtain disk information.

Get-Member
The Get-Member cmdlet gets the members (properties and methods) of objects.

Object properties may be accessed using. notation.

Object methods are called the same way.

Enable Remote WMI
The following command enables remote WMI traffic through the local Windows firewall.

Disable Remote WMI
The following command disables remote WMI traffic through the local Windows firewall.

Use Remote WMI
The Get-WmiObject cmdlet may be used to connect to remote computers using the -ComputerName parameter, with a specified Credential if necessary.

Enable-PSRemoting
The Enable-PSRemoting cmdlet configures the computer to receive Windows PowerShell remote commands that are sent by using the WS-Management technology.

Disable-PSRemoting
The Disable-PSRemoting cmdlet prevents users on other computers from running commands on the local computer.

Trusted Hosts
TrustedHosts allows a local computer to send authentication credentials to a remote computer in a non-domain environment. The Set-Item cmdlet is used to add a remote host to the TrustedHosts list. Specify the computer name or IP address for the RemoteHost.

Enter-PSSession
The Enter-PSSession cmdlet starts an interactive PowerShell session with a single remote computer. During the session, the commands that you type run on the remote computer, just as though you were typing directly on the remote computer. You can have only one interactive session at a time.

Exit-PSSession
The Exit-PSSession cmdlet ends interactive sessions that you started by using Enter-PSSession.

Activities

 * 1) Review Microsoft TechNet: Using the Get-WMiObject Cmdlet.  Create a script to retrieve BIOS information from the local system.  Compare the results with the most recent BIOS version available from your system's manufacturer.  If a BIOS update is available, review the update information and determine whether or not you should upgrade your BIOS.
 * 2) Create a script that uses the WMI Win32_ComputerSystem and Win32_NetworkAdapterConfiguration to collect information for your computer.  Use Get-Member to identify properties available in these classes.  Include:
 * 3) * Computer Name
 * 4) * Manufacturer
 * 5) * Model
 * 6) * RAM
 * 7) * User Name
 * 8) * IP Addresses (could have more than one)
 * 9) * MAC Addresses (could have more than one)
 * 10) * Any other information you would like to include
 * 11) Review Microsoft MSDN: Connecting to WMI Remotely Starting with Windows Vista and Microsoft MSDN: Connecting to WMI on a Remote Computer by Using Windows PowerShell.  Enable remote WMI on one or more computers on your network.  Create a script that uses Get-WmiObject with the -Computer parameter to extend the computer information script from above and gather information from remote computers on the network.
 * 12) Review Microsoft TechNet: Enable-PSRemoting and Microsoft TechNet: Running Remote Commands.  Enable remote PowerShell on one or more computers on your network.  Create a script that uses the Enter-PSSession cmdlet to enter a session on a remote computer and gather the same computer information from above.  Identify situations in which PowerShell Remoting would be a better solution than Remote WMI.

Lesson Summary

 * Systems management refers to enterprise-wide administration of distributed systems, including computer systems.
 * Centralized management has a time and effort trade-off that is related to the size of the company, the expertise of the IT staff, and the amount of technology being used.
 * Windows Management Instrumentation (WMI) is a set of extensions to the Windows Driver Model that provides an operating system interface through which instrumented components provide information and notification.
 * WMI is Microsoft's implementation of the Web-Based Enterprise Management (WBEM) and Common Information Model (CIM) standards from the Distributed Management Task Force (DMTF).
 * WMI allows scripting languages like VBScript or Windows PowerShell to manage Microsoft Windows personal computers and servers, both locally and remotely, and is preinstalled in Windows 2000 and newer OSs.
 * Most leading management-software packages are WMI-enabled and capable of consuming and providing WMI information through various user interfaces.
 * WMI features include:
 * Automation interfaces
 * .NET Management interfaces
 * C/C++ COM/DCOM programming interfaces
 * Remoting capabilities over DCOM and SOAP
 * Support for queries
 * Eventing capabilities
 * Code template generator
 * Predictability
 * Protects existing customer investments
 * Provides a logical and unified administration model
 * The Get-WmiObject cmdlet gets instances of WMI classes or information about the available WMI classes.
 * The Win32_BIOS WMI class represents the attributes of the computer system's basic input/output services (BIOS) that are installed on a computer.
 * The Win32_ComputerSystem class represents a computer system operating in a Windows environment.
 * The Win32_NetworkAdapterConfiguration class represents the attributes and behaviors of a network adapter.
 * The Get-Member cmdlet gets the members (properties and methods) of objects. Object properties and methods may be accessed using . notation.
 * The netsh command enables and disables remote WMI traffic through the local Windows firewall.
 * The Get-WmiObject cmdlet may be used to connect to remote computers using the -ComputerName parameter, with a specified Credential if necessary.
 * The Enable-PSRemoting cmdlet configures the computer to receive Windows PowerShell remote commands that are sent by using the WS-Management technology.
 * The Disable-PSRemoting cmdlet prevents users on other computers from running commands on the local computer.
 * TrustedHosts allows a local computer to send authentication credentials to a remote computer in a non-domain environment. The Set-Item cmdlet is used to add a remote host to the TrustedHosts list.
 * The Enter-PSSession cmdlet starts an interactive PowerShell session with a single remote computer. During the session, the commands that you type run on the remote computer, just as though you were typing directly on the remote computer. You can have only one interactive session at a time.
 * The Exit-PSSession cmdlet ends interactive sessions that you started by using Enter-PSSession.

Key Terms

 * Common Information Model (CIM)
 * An open standard that defines how managed elements in an IT environment are represented as a common set of objects and relationships between them.


 * Distributed Management Task Force (DMTF)
 * An organization of companies that collaborate on the development, validation and promotion of infrastructure management standards that enable effective management of IT environments.


 * Web-Based Enterprise Management (WBEM)
 * A set of systems management technologies developed to unify the management of distributed computing environments.


 * Windows Driver Model (WDM)
 * A framework for device drivers that was introduced with Windows 98 and Windows 2000 to replace the older VxD, and Windows NT Driver models.

Assessments

 * Flashcards: Quizlet: Windows PowerShell - Systems Management
 * Quiz: Quizlet: Windows PowerShell - Systems Management