Added modules from WinAPI
This commit is contained in:
parent
56da334ea2
commit
b709d7e96b
24 changed files with 657 additions and 125 deletions
21
Scripts/Get-Event.psm1
Normal file
21
Scripts/Get-Event.psm1
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
function Get-Event {
|
||||
param (
|
||||
[string]$LogName,
|
||||
[switch]$List
|
||||
)
|
||||
if ($List) {
|
||||
Get-WinEvent -ListLog * | Where-Object RecordCount -gt 0 |
|
||||
Select-Object RecordCount,
|
||||
@{Name="LastWriteTime"; Expression={Get-Date -Date $($_.LastWriteTime) -UFormat "%d.%m.%Y %T"}},
|
||||
@{Name="FileSize"; Expression={($_.FileSize / 1024kb).ToString("0.00 Mb")}},
|
||||
LogIsolation,
|
||||
LogType,
|
||||
LogName | Sort-Object LogIsolation
|
||||
}
|
||||
else {
|
||||
Get-WinEvent -LogName $LogName | Select-Object @{Name="TimeCreated"; Expression={Get-Date -Date $($_.TimeCreated) -UFormat "%d.%m.%Y %T"}},
|
||||
LevelDisplayName,
|
||||
Level,
|
||||
Message
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue