0

Server Monitoring Through Windows PowerShell

Monday, 6 January 2014

Two of these cmdlets are new, and they both relate to virtual machine eventing, a minor new feature in Windows Server 2012 that is not well documented at the time of this writing. According to Get-Help and Windows PowerShell documentation at http://technet.microsoft.com/en-us/library/hh848462, “[v]irtual machine eventing keeps Hyper-V PowerShell objects updated without polling the virtual machine host.” You should be aware that it is enabled by default, and you can use the cmdlets Enable-VMEventing and Disable-VMEventing to reenable and disable the feature, respectively.
Use Table 5-1 to review some of the important Windows PowerShell cmdlets and other commands that relate to server monitoring. (More cmdlets are available to manage events. For a full list, type get-command *event* | sort noun,verb at a Windows PowerShell prompt.)

TABLE 5-1 Common command-line tools for server monitoring:

CMDLET OR COMMAND-LINE UTILITY              DESCRIPTION
Export-Counter                                                  Exports data that is returned by the                                                                             and Import-Counter cmdlets
Get-Counter                                                       Gets performance counter data from local and
                                                                           remote  computers
Import-Counter                                                  Imports performance counter log files (.blg, .csv, .tsv) and
                                                                          creates the objects that represent each counter sample in
                                                                          the log
Get-Event                                                          Gets events in the Windows PowerShell event queue for the
                                                                          current session
New-Event                                                        Creates a new custom event
Clear-EventLog                                                 Deletes all entries from specified event logs on the local or
                                                                         remote computers
Get-EventLog                                                   Manages event logs and displays events contained within
                                                                         those event logs
Enable-VMEventing                                         Enables virtual machine eventing
Disable-VMEventing                                        Disables virtual machine eventing        
Logman.exe                                                     Manages and schedules performance counter and
                                                                       event trace log collections on local and remote systems