-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtask21.psm1
More file actions
25 lines (23 loc) · 947 Bytes
/
task21.psm1
File metadata and controls
25 lines (23 loc) · 947 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<#
Написать функцию с помощью которой можно посмотреть все события в журнале приложений
за указанный период с ограничением количества (период и ограничение количества передать
как параметры).
#>
function Get-ApplicationEventLog {
param (
[datetime] $After,
[datetime] $Before,
[int] $Limit = 100
)
if ($After -and $Before) {
return Get-EventLog -LogName Application -Newest $Limit -After $After -Before $Before
}
elseif ($After) {
return Get-EventLog -LogName Application -Newest $Limit -After $After
}
elseif ($Before) {
return Get-EventLog -LogName Application -Newest $Limit -Before $Before
}
return Get-EventLog -LogName Application -Newest $Limit
}
Export-ModuleMember Get-ApplicationEventLog