mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Add a simple test for Get-WinEvent on windows (Core + Full)
This commit is contained in:
@@ -122,6 +122,20 @@ try
|
||||
Remove-Module -ErrorAction SilentlyContinue CimCmdlets
|
||||
}
|
||||
}
|
||||
|
||||
It 'loads Microsoft.PowerShell.Diagnostics' {
|
||||
try
|
||||
{
|
||||
Import-Module Microsoft.PowerShell.Diagnostics -ErrorAction Stop
|
||||
Get-WinEvent -LogName System -MaxEvents 1 | Should Not Be $null
|
||||
[Microsoft.PowerShell.Commands.GetWinEventCommand].Assembly.Location | Should Be (
|
||||
Join-Path $env:DEVPATH Microsoft.PowerShell.Commands.Diagnostics.dll)
|
||||
}
|
||||
finally
|
||||
{
|
||||
Remove-Module -ErrorAction SilentlyContinue Microsoft.PowerShell.Diagnostics
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
Describe 'Get-WinEvent' {
|
||||
|
||||
# Get-WinEvent works only on windows
|
||||
It 'can query a System log' -Skip:(-not $IsWindows) {
|
||||
Get-WinEvent -LogName System -MaxEvents 1 | Should Not Be $null
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user