3.2. A New Cross-Tool Approach
PowerShell is intended to provide nearly complete coverage of the administration tasks of Windows machines using cmdlets. Not everything that is needed to do that is available in PowerShell version 1. One approach you can use to fill in the gaps in PowerShell 1.0 is to use .NET classes, as described in the preceding section. Another approach is to use Windows Management Instrumentation. PowerShell provides a get-wmiobject cmdlet to allow you to retrieve information about machine state. For example, to retrieve the current date and time using WMI, type the following command:
get-wmiobject –Namespace root\cimv2 –Class Win32_CurrentTime
which can be abbreviated to:
get-wmiobject Win32_CurrentTime
As you can see in Figure 3-5, information about the current date and time is displayed.
Figure 3.5. Figure 3-5
One use of WMI that is particularly important in PowerShell version 1.0 is accessing remote machines. The core cmdlets in PowerShell 1.0 only access the local machine.
NOTE
An alternative approach to remote machine access using cmdlets is to use .NET Framework classes. However, some Exchange Server 2007 cmdlets have support for accessing remote machines.
3.2.1. GUI Shell (MMC Layered over PowerShell)
The aim of the Windows PowerShell team is that the next generation of the Microsoft Management Console, MMC 3.0, will provide a graphical user interface ...
Get Professional Windows® PowerShell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.