forked from gtworek/PSBits
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGet-ServiceDlls.ps1
32 lines (31 loc) · 1007 Bytes
/
Get-ServiceDlls.ps1
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
$keys = Get-ChildItem "HKLM:\SYSTEM\CurrentControlSet\Services\"
foreach ($key in $keys)
{
$ImagePath = (Get-ItemProperty ($key.pspath)).ImagePath
if ($null -ne $ImagePath)
{
if ($ImagePath.Contains("\svchost.exe"))
{
if (Test-Path ($key.pspath+"\Parameters"))
{
$ServiceDll = (Get-ItemProperty ($key.pspath+"\Parameters")).ServiceDll
}
else
{
$ServiceDll = (Get-ItemProperty ($key.pspath)).ServiceDll
}
if ($null -ne $ServiceDll)
{
Write-Host ($key.PsChildName+"`t"+$ServiceDll+"`t") -NoNewline
if ((Get-AuthenticodeSignature $ServiceDll).IsOSBinary)
{
Write-Host -ForegroundColor Green "OS Binary"
}
else
{
Write-Host -ForegroundColor red "External Binary"
}
}
}
}
}