Databases Reference
In-Depth Information
Figure 6-26
Windows PowerShell also provides two other cmdlets,
New
-
EventLog
and
Remove
-
EventLog
,whichare
widely used for creating custom event logs. These cmdlets are not discussed here because they are not
useful for SQL Server administration.
The
Clear-EventLog
cmdlet deletes all of the entries from the specified event logs on either the local
computer or remote computers.
The next example attempts to clear the events from the Application event log using the
-confirm
switch.
Execute the following command, as shown in Figure 6-27. Select ''No'' when asked for confirmation.
Clear-EventLog -Logname "Application" -confirm
Figure 6-27
Now clear the event log related to Windows PowerShell using the
-confirm
switch. This time, select
''Yes'' when it prompts for confirmation, as shown in Figure 6-28.
Now use Event Viewer to see whether all the information in the Windows PowerShell event log has
been cleared. Launch
EventVwr
using one of the methods illustrated in the beginning of this chapter (see
Figure 6-29).
Another useful cmdlet is
Show-EventLog
, which when executed opens the
EventVwr
on the local
machine. If you want to see the event logs of a remote computer using
EventVwr
, you could execute the
Search WWH ::
Custom Search