Created
March 19, 2021 01:45
-
-
Save ElJefeDSecurIT/584d4dabf283fbd0346e41b5e4ecdabd to your computer and use it in GitHub Desktop.
powershell host inventory samples.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#purpose: how many ways can you inventory what's on a windows host? let me count the ways! | |
#this script captures a bunch of ways to know what's on a host. useful for inventory of host features, installed store apps, | |
#even figure what winget did under the hood, if youre wondering how to list apps on your host. | |
# | |
#what Capabilities are on this machine? | |
Get-WindowsCapability -Online ` | |
| where-object State -eq Installed ` | |
| Format-Table | |
# you wanna know what each of those things are? | |
Get-WindowsCapability -Online ` | |
| where-object State -eq Installed ` | |
| ForEach-Object { Get-WindowsCapability -Online -Name $_.Name } ` | |
| format-table | |
#what Optional Features are enabled on this machine? | |
Get-WindowsOptionalFeature -Online | where-object State -eq Enabled ` | |
| ForEach-Object { Get-WindowsOptionalFeature -online -FeatureName $_.FeatureName } ` | |
| Select-Object FeatureName, State, DisplayName, Description, RestartNeeded, Capacity, Online -ExpandProperty CustomProperties ` | |
| Format-Table | |
# What's been installed on this Machine natively ala old fashioned Add/Remove Programs? | |
gwmi Win32_Product | Format-Table | |
# What's installed by the Store App | |
Get-AppxPackage -AllUsers ` | |
|where-object SignatureKind -eq Store ` | |
| Select-Object Name, Version, SignatureKind, Architecture, PublisherId, Publisher | format-table | |
#some hidden gems; by default the above only returns Framework and Main PackageTypes. | |
#there's some interesitng ones installed, and how theyre' installed by bundle: | |
Get-AppxPackage AllUsers -PackageTypeFilter Bundle | format-table | |
Get-AppxPackage AllUsers -PackageTypeFilter Resource | format-table |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment