-
Notifications
You must be signed in to change notification settings - Fork 0
/
Forensics.psm1
52 lines (39 loc) · 1.47 KB
/
Forensics.psm1
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#---------------------Collection of Windows Forensics Functions-------------------
<# \RecentDocs
HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\RecentDocs
These will show recent files which have been interacted with by the user
#>
function Get-RecentDocs
{
[cmdletbinding()]
Param
(
[Parameter(ValueFromPipeline=$true)]
[string[]]
$ComputerName,
[pscredential]
$Credential
)
Begin
{
If (!$Credential) {$Credential = Get-Credential}
}
Process
{
Invoke-Command -ComputerName $ComputerName -Credential $Credential -ScriptBlock {
Get-ChildItem -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\RecentDocs | ForEach-Object {
$files = Get-ItemProperty ("HKCU:\" + $_.Name.Substring($_.Name.IndexOf('\')+1))
$extension = $_.Name.Substring($_.Name.IndexOf('.')+1)
$files.PSObject.Properties | ForEach-Object {
if($_.Name -match "^\d+$")
{
[PSCustomObject]@{
Extension = $extension
FileName = [System.Text.Encoding]::ASCII.GetString($_.Value)
}
} #End if
} #End ForEach
} #End ForEach
} #End Invoke
} #End Process
}