-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathwmi-full-enum.ps1
63 lines (47 loc) · 2.03 KB
/
wmi-full-enum.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# Have it write to XML
# have it zip the xml?
# the line below generates an error... why?
# Get-WmiObject -Class __TimerEvent | get-member
# Get all the wmi objects we'll loop through
$WMIObjects = Get-WMIObject -List *
# Loop through each WMIObject class and pull the properties, methods, and the output thereof.
foreach ($item in $WMIObjects) {
# Show where we are in the processing queue
$Item.name
$FileName = "C:\wmi-hax\results\properties\$($Item.Name)-Properties.txt"
$OutputStream = [System.IO.StreamWriter] $FileName
# pull the properties
#get-wmiobject -class CIM_DiskDrive | Get-Member -MemberType Properties
$Properties = Get-WmiObject -Class $item.name | Get-Member -MemberType Properties
$OutputStream.WriteLine("-----------------`n")
$OutputStream.WriteLine("$($Item.Name) full properties`n")
$OutputStream.WriteLine("-----------------`n")
foreach ( $PropertyItem in $Properties ) {
$OutputStream.WriteLine("$PropertyItem")
}
$OutputStream.close()
$FileName = "C:\wmi-hax\results\methods\$($Item.Name)-Methods.txt"
$OutputStream = [System.IO.StreamWriter] $FileName
# pull the methods
#get-wmiobject -class CIM_DiskDrive | Get-Member -MemberType Method
$AllMethods = get-wmiobject -class $item.name | Get-Member -MemberType Method
$OutputStream.WriteLine("-----------------`n")
$OutputStream.WriteLine("$($Item.Name) full Methods`n")
$OutputStream.WriteLine("-----------------`n")
foreach ( $Method in $AllMethods ) {
$OutputStream.WriteLine("$Method")
}
$OutputStream.close()
$FileName = "C:\wmi-hax\results\output\$($Item.Name)-output.txt"
$OutputStream = [System.IO.StreamWriter] $FileName
# now pull all info that you can...
$FullInfo = get-wmiobject -class CIM_DiskDrive | Format-List -Property *
$OutputStream.WriteLine("-----------------`n")
$OutputStream.WriteLine("$($Item.Name) full info`n")
$OutputStream.WriteLine("-----------------`n")
foreach ( $FullInfoItem in $FullInfo) {
$OutputStream.WriteLine("$FullInfoItem")
}
# Done with the stream, we don't need it anymore
$OutputStream.close()
}