49 lines
1.3 KiB
PowerShell
49 lines
1.3 KiB
PowerShell
# Get a list of all installed software from the Windows software library
|
|
$installedSoftware = Get-Package
|
|
|
|
# Get a list of all installed Windows updates
|
|
$installedUpdates = Get-HotFix
|
|
|
|
# Get a list of all Chocolatey packages
|
|
$chocoPackages = choco list --localonly
|
|
|
|
# Create a variable to hold all of the information
|
|
$sbom = @()
|
|
|
|
# Add the installed software to the SBOM
|
|
$sbom += $installedSoftware
|
|
|
|
# Add the formatted updates to the SBOM
|
|
$sbom += $installedUpdates
|
|
|
|
# Add the Chocolatey packages to the SBOM
|
|
$sbom += $chocoPackages
|
|
|
|
# Get the folder path
|
|
$folderPath = "C:\Forensic Program Files"
|
|
|
|
# Get all EXE files in the folder and its subfolders
|
|
$exeFiles = Get-ChildItem $folderPath -Recurse -Filter "*.exe"
|
|
|
|
# Create a variable to hold the EXE file information
|
|
$exeInfo = @()
|
|
|
|
# Loop through each EXE file
|
|
foreach ($exeFile in $exeFiles) {
|
|
# Get the file version information
|
|
$fileVersion = [System.Diagnostics.FileVersionInfo]::GetVersionInfo($exeFile.FullName)
|
|
|
|
# Add the EXE file information to the array
|
|
$exeInfo += New-Object PSObject -Property @{
|
|
"Path" = $exeFile.FullName
|
|
"Product Name" = $fileVersion.ProductName
|
|
"Product Version" = $fileVersion.ProductVersion
|
|
}
|
|
}
|
|
|
|
# Add the EXE file information to the SBOM
|
|
$sbom += $exeInfo
|
|
|
|
# Export the SBOM to a CSV file
|
|
$sbom | Export-Csv C:\tmp\sbom.csv -NoTypeInformation
|