├── Discovery.pipeworks.psd1 ├── Discovery.psd1 ├── Discovery.psm1 ├── Find-CommandWithParameterType.ps1 ├── Get-ExtensionMethod.ps1 ├── Get-ProgID.ps1 ├── Get-Type.ps1 ├── InstallAddComType.ps1 ├── Readme.md ├── Search-WMI.ps1 └── en-us └── About_Discovery.help.txt /Discovery.pipeworks.psd1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StartAutomating/Discovery/5d711c6f44d0ea6eacd6a3d1d1640525952a8d25/Discovery.pipeworks.psd1 -------------------------------------------------------------------------------- /Discovery.psd1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StartAutomating/Discovery/5d711c6f44d0ea6eacd6a3d1d1640525952a8d25/Discovery.psd1 -------------------------------------------------------------------------------- /Discovery.psm1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StartAutomating/Discovery/5d711c6f44d0ea6eacd6a3d1d1640525952a8d25/Discovery.psm1 -------------------------------------------------------------------------------- /Find-CommandWithParameterType.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StartAutomating/Discovery/5d711c6f44d0ea6eacd6a3d1d1640525952a8d25/Find-CommandWithParameterType.ps1 -------------------------------------------------------------------------------- /Get-ExtensionMethod.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StartAutomating/Discovery/5d711c6f44d0ea6eacd6a3d1d1640525952a8d25/Get-ExtensionMethod.ps1 -------------------------------------------------------------------------------- /Get-ProgID.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StartAutomating/Discovery/5d711c6f44d0ea6eacd6a3d1d1640525952a8d25/Get-ProgID.ps1 -------------------------------------------------------------------------------- /Get-Type.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StartAutomating/Discovery/5d711c6f44d0ea6eacd6a3d1d1640525952a8d25/Get-Type.ps1 -------------------------------------------------------------------------------- /InstallAddComType.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StartAutomating/Discovery/5d711c6f44d0ea6eacd6a3d1d1640525952a8d25/InstallAddComType.ps1 -------------------------------------------------------------------------------- /Readme.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | [Official Website](http://Discovery.Start-Automating.com) 4 | 5 | 6 | 7 | 8 | Discovery is a powerful PowerShell module that lets you probe the inner depths of the operating system. 9 | 10 | You can search .NET types with reflection using Get-Type, find every COM object on the system with Get-ProgID, search the WMI repository for useful tidbits with Search-Wmi, and find commands that can handle specific types of data with Find-CommandWithParameterType. 11 | 12 | 13 | -------------------------------------------------------------------------------- /Search-WMI.ps1: -------------------------------------------------------------------------------- 1 | function Search-Wmi 2 | { 3 | <# 4 | .Synopsis 5 | Searches the WMI repository 6 | .Description 7 | Searches the help metadata that is built into the WMI repository 8 | to find WMI classes to fit a particular need. The search can 9 | look for: 10 | - Information by class name 11 | - Keywords in the description text 12 | - Keywords in property names or descriptions 13 | - Keywords in method names or descriptions 14 | .Example 15 | # Get all class information from root\cimv2 namespace 16 | Search-WMI 17 | .Example 18 | # 19 | Search-Wmi -ForName *registry* -Namespace root\default 20 | .Example 21 | # Save Everything in Root Default 22 | Search-Wmi -Namespace root\default | Export-Clixml .\root.default.clixml 23 | #> 24 | param( 25 | # The name of the class you'd like to search for. By default, * 26 | [Parameter(ValueFromPipelineByPropertyName=$true)] 27 | [String]$ForName = "*", 28 | 29 | 30 | # If provided, will search for specific text in a class description 31 | [Parameter(ValueFromPipelineByPropertyName=$true)] 32 | [String]$ForTextInDescription, 33 | 34 | # If provided, will look for specific property names on a wmi class 35 | [Parameter(ValueFromPipelineByPropertyName=$true)] 36 | [string]$ForAPropertyLike, 37 | # If set, will return properties that can write 38 | [switch]$OnlyIfThePropertyCanWrite, 39 | # If provided, will look for specific method names on a wmi class 40 | [Parameter(ValueFromPipelineByPropertyName=$true)] 41 | [string]$ForAMethodLike, 42 | # The namespace you'd like to search in, by default root\CIMv2 43 | [Parameter(ValueFromPipelineByPropertyName=$true)] 44 | [string]$Namespace = "root\cimv2", 45 | # If set, will only return wmi types that can be created 46 | [switch]$OnlyIfItCanBeCreated, 47 | # If set, will only return WMI types that can be deleted 48 | [switch]$OnlyIfItCanBeDeleted, 49 | # If set, will only return WMI types that can be updated 50 | [switch]$OnlyIfItCanBeUpdated, 51 | # The name of the computer to get WMI information from 52 | [string]$ComputerName, 53 | # The credential used to connect to the computer 54 | [Management.Automation.PSCredential]$Credential, 55 | # If set, will search recursively 56 | [Switch]$Recurse, 57 | # If set, will only search for WMI event classes 58 | [Switch]$OnlySearchForAnEvent 59 | ) 60 | 61 | 62 | process { 63 | Get-WmiObject $ForName -Namespace $namespace -Recurse:$Recurse -Amended -List | 64 | Select-Object @{ 65 | Name='Class' 66 | Expression={ 67 | Write-Progress "Getting WMI Data" " $($_.Name)" 68 | $_.Name 69 | 70 | } 71 | }, @{ 72 | Name='Namespace' 73 | Expression={ 74 | $_.__Namespace 75 | } 76 | }, @{ 77 | Name='Description' 78 | Expression={ 79 | 80 | $_.Qualifiers.Item("Description").Value 81 | } 82 | },@{ 83 | Name='CanCreate' 84 | Expression={ 85 | try { 86 | [bool](($_.Qualifiers.Item('SupportsCreate').Value)) 87 | } catch { 88 | $false 89 | } 90 | } 91 | }, @{ 92 | Name='CanUpdate' 93 | Expression={ 94 | try { 95 | [bool](($_.Qualifiers.Item('SupportsUpdate').Value)) 96 | } catch { 97 | $false 98 | }} 99 | }, @{ 100 | Name='CanDelete' 101 | Expression={ 102 | try { 103 | [bool]($_.Qualifiers.Item('SupportsDelete').Value) 104 | } catch { 105 | $false 106 | } 107 | 108 | } 109 | }, @{ 110 | Name='IsAbstract' 111 | Expression={ 112 | try { 113 | [bool]($_.Qualifiers.Item('Abstract').Value) 114 | } catch { 115 | $false 116 | } 117 | } 118 | },@{ 119 | Name='IsSingleton' 120 | Expression={ 121 | try { 122 | [bool]$_.Qualifiers.Item('Singleton').Value 123 | } catch { 124 | $false 125 | } 126 | 127 | } 128 | },@{ 129 | Name='IsAssociation' 130 | Expression={ 131 | try { 132 | [bool]$_.Qualifiers.Item('Association').Value 133 | } catch { 134 | $false 135 | } 136 | 137 | } 138 | },@{ 139 | Name='Provider' 140 | Expression={ 141 | try { 142 | $_.Qualifiers.Item('Provider').Value 143 | } catch { 144 | "" 145 | } 146 | 147 | } 148 | },@{ 149 | Label='Privileges' 150 | Expression = { 151 | try { 152 | $_.Qualifiers.Item("Privileges").Value -join ',' 153 | } catch { 154 | "" 155 | } 156 | } 157 | },@{ 158 | Name='Properties' 159 | Expression={ 160 | $_.Properties | 161 | Select-Object @{ 162 | Label='PropertyName' 163 | Expression={$_.Name} 164 | }, @{ 165 | Label='PropertyType' 166 | Expression={$_.Type} 167 | }, @{ 168 | Label='Description' 169 | Expression={$_.Qualifiers.Item("Description").Value} 170 | }, @{ 171 | Label='CanRead' 172 | Expression={$_.Qualifiers.Item("Read").Value} 173 | }, @{ 174 | Label='CanWrite' 175 | Expression={ 176 | try { 177 | $_.Qualifiers.Item("Write").Value 178 | } catch { 179 | $false 180 | } 181 | } 182 | }, @{ 183 | Label='References' 184 | Expression = { 185 | try { 186 | $v = $_.Qualifiers.Item("CimType").Value 187 | if ($v -like "ref:*") { 188 | $v.Substring(4) 189 | } else { 190 | $null 191 | } 192 | } catch { 193 | $false 194 | } 195 | } 196 | }, @{ 197 | Label='MapsTo' 198 | Expression = { 199 | try { 200 | $_.Qualifiers.Item("MappingStrings").Value 201 | 202 | } catch { 203 | "" 204 | } 205 | } 206 | }, @{ 207 | Label='Privileges' 208 | Expression = { 209 | try { 210 | $_.Qualifiers.Item("Privileges").Value -join ',' 211 | } catch { 212 | "" 213 | } 214 | } 215 | }, @{ 216 | Label='Units' 217 | Expression = { 218 | try { 219 | $_.Qualifiers.Item("Units").Value 220 | } catch { 221 | "" 222 | } 223 | } 224 | } 225 | 226 | 227 | } 228 | }, @{ 229 | Name='Methods' 230 | Expression={ 231 | $_.Methods | 232 | Select-Object @{ 233 | Label='MethodName' 234 | Expression={$_.Name} 235 | }, @{ 236 | Label='Description' 237 | Expression={$_.Qualifiers.Item("Description").Value} 238 | }, @{ 239 | Label='MapsTo' 240 | Expression = { 241 | try { 242 | $_.Qualifiers.Item("MappingStrings").Value 243 | 244 | } catch { 245 | "" 246 | } 247 | } 248 | }, @{ 249 | Label='Privileges' 250 | Expression = { 251 | try { 252 | $_.Qualifiers.Item("Privileges").Value -join ',' 253 | } catch { 254 | "" 255 | } 256 | } 257 | }, @{ 258 | Label='IsStatic' 259 | Expression = { 260 | try { 261 | [bool]$_.Qualifiers.Item("Static").Value 262 | } catch { 263 | $false 264 | } 265 | } 266 | }, @{ 267 | Label='IsConstructor' 268 | Expression = { 269 | try { 270 | [bool]$_.Qualifiers.Item("Constructor").Value 271 | } catch { 272 | $false 273 | } 274 | } 275 | }, @{ 276 | Label='IsDestructor' 277 | Expression = { 278 | try { 279 | [bool]$_.Qualifiers.Item("Destructor").Value 280 | } catch { 281 | $false 282 | } 283 | } 284 | } 285 | } 286 | }, @{ 287 | Name='IsEvent' 288 | Expression = { $_.Derivation -contains '__Event' } 289 | }, @{ 290 | Name='IsSystemClass' 291 | Expression = { $_.Derivation -contains '__SystemClass' } 292 | }, @{ 293 | Name='IsDeprecated' 294 | Expression = { 295 | try { 296 | $_.Qualifiers.Item("DEPRECATED").Value 297 | } catch { 298 | $false 299 | } 300 | } 301 | }| 302 | Where-Object { 303 | if ($OnlyIfItCanBeCreated) { 304 | $stillOk = $_.CanCreate 305 | if (-not $stillOk) { return } 306 | } 307 | if ($OnlyIfItCanBeDeleted) { 308 | $stillOk = $_.CanDelete 309 | if (-not $stillOk) { return } 310 | } 311 | if ($OnlyIfItCanBeUpdated) { 312 | $stillOk = $_.CanUpdate 313 | if (-not $stillOk) { return } 314 | } 315 | if ($ForAPropertyLike) { 316 | $stillOk = $_.Properties | 317 | Where-Object { 318 | ($_.PropertyName -like $ForAPropertyLike -or 319 | $_.Description -like $ForAPropertyLike) -and 320 | (((-not $OnlyIfThePropertyCanWrite) -or 321 | ($OnlyIfThePropertyCanWrite -and $_.CanWrite))) 322 | } 323 | if (-not $stillOk ) { return } 324 | } 325 | 326 | if ($ForAMethodLike) { 327 | $stillOk = $_.Methods | 328 | Where-Object { 329 | $_.MethodName -like $ForAMethodLike -or 330 | $_.Description -like $ForAMethodLike 331 | } 332 | if (-not $stillOk) { return } 333 | } 334 | 335 | if ($OnlySearchForAnEvent) { 336 | $stillOk = $_.IsEvent 337 | if (-not $stillOk) { return } 338 | } 339 | 340 | if ($ForTextInDescription) { 341 | $stillOk = $_.Description -like "*$ForTextInDescription*" 342 | if (-not $stillOk) { return } 343 | } 344 | 345 | 346 | 347 | return $true 348 | 349 | } | ForEach-Object { 350 | $_.psobject.typenames.clear() 351 | $_.psobject.typenames.add('WmiInfo') 352 | $_ 353 | } 354 | 355 | Write-Progress "Getting WMI Data" "Complete" -Completed 356 | } 357 | } -------------------------------------------------------------------------------- /en-us/About_Discovery.help.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StartAutomating/Discovery/5d711c6f44d0ea6eacd6a3d1d1640525952a8d25/en-us/About_Discovery.help.txt --------------------------------------------------------------------------------