This article provides a PowerShell script that scans a specified directory (and its subdirectories) for DLL and EXE files. It extracts version information and SHA256 hashes from each file and saves the results in timestamped CSV files.
Use this script to audit the version details of DLL and EXE files in your Snow Software installation directory, for example, during troubleshooting, validation, or inventory checks.
Script summary
Parameters
$SnowDirectory: Path to the Snow Software directory to scan.
Default: C:\Program Files\Snow Software\Snow License Manager\Services
$OutputDir: Path to the directory where the output CSV files will be saved.
Default: C:\Temp
Functions
Ensure-FolderExists: Creates the output directory if it doesn’t exist.Get-Timestamp: Returns the current date and time inyyyy-MM-dd_HH-mm-ssformat.Get-FileVersionInfo: Retrieves file version, product version, and SHA256 hash.Process-Files: Finds all.dllor.exefiles, gathers version data, and exports it to CSV.
How the script works
- Ensures the output directory exists.
- Generates a timestamp to uniquely name the output files.
- Builds filenames for DLL and EXE results using the timestamp.
- Processes all .dll files in the target directory and writes results to a CSV file.
- Processes all .exe files and writes those results to a separate CSV file.
Sample output
You will get two CSV files in the specified output directory:
listdll_<timestamp>.csvlistexe_<timestamp>.csv
Each file contains the following fields:
- Name
- Path
- FileVersion
- ProductVersion
- SHA256
Full script
# Script to extract DLL and EXE version numbers from the Snow directory - v2.0
param (
[string]$SnowDirectory = "C:\Program Files\Snow Software\Snow License Manager\Services",
[string]$OutputDir = "C:\Temp",
[switch]$SkipSignatureCheck
)
# Ensure output directory exists
function Ensure-FolderExists {
param ($FolderPath)
if (!(Test-Path $FolderPath)) {
New-Item -Path $FolderPath -ItemType Directory -Force | Out-Null
}
}
# Generate timestamp in ISO format: YYYY-MM-DD_HH-mm-ss
function Get-Timestamp {
return Get-Date -Format "yyyy-MM-dd_HH-mm-ss"
}
# Function to get version details and compute SHA256 hash
function Get-FileVersionInfo {
param ($FilePath)
try {
$file = Get-Item $FilePath
$versionInfo = $file.VersionInfo
$fileVersion = "$($versionInfo.FileVersion)"
$productVersion = "$($versionInfo.ProductVersion)"
$fileHash = (Get-FileHash -Path $FilePath -Algorithm SHA256).Hash
return [PSCustomObject]@{
Name = $file.Name
Path = $file.FullName
FileVersion = $fileVersion
ProductVersion = $productVersion
SHA256 = $fileHash
}
} catch {
Write-Error "Failed to process ${FilePath}: $($_.Exception.Message)"
return $null
}
}
# Function to process files and export results to CSV
function Process-Files {
param (
[string]$SearchPattern,
[string]$OutputFile
)
Write-Host "Scanning for $SearchPattern files in $SnowDirectory..."
$files = Get-ChildItem -Path $SnowDirectory -Recurse -Filter $SearchPattern -File -ErrorAction SilentlyContinue
$results = @()
foreach ($file in $files) {
$info = Get-FileVersionInfo -FilePath $file.FullName
if ($info) {
$results += $info
}
}
if ($results.Count -gt 0) {
$results | Export-Csv -Path $OutputFile -NoTypeInformation -Encoding UTF8
Write-Host "Saved results to $OutputFile"
} else {
Write-Warning "No $SearchPattern files found or failed to extract info."
}
}
# Main script logic
Ensure-FolderExists $OutputDir
$Timestamp = Get-Timestamp
$targetdll = "$OutputDir\listdll_$Timestamp.csv"
$targetexe = "$OutputDir\listexe_$Timestamp.csv"
Process-Files -SearchPattern "*.dll" -OutputFile $targetdll
Process-Files -SearchPattern "*.exe" -OutputFile $targetexe
Related Articles
FlexNet agent (ndtrack) may trigger a security software warning due to PowerShell script execution containing unusual char… 76Number of Views PowerShell script to delete the Snow MongoDB service 5Number of Views PowerShell script to rebuild the Snow MongoDB Windows service 8Number of Views PowerShell script to rebuild the Snow Update Service 27Number of Views PowerShell script to monitor the process and folders used by the cloud metering process 73Number of Views
Hi, I am Reva - Ask me anything.
No new updates
Thanks for the feedback!
Your feedback has been saved.Rate this response:
Add Additional feedback ( Optional )
Are you sure you want to cancel
the case creation?
Are you sure you want to cancel the case creation?
Are you sure you want to close this case
| Products | Region | Phone Numbers |
|---|---|---|
| FlexNet Operations FlexNet Embedded FlexNet Publisher FlexNet Connect FlexNet Code Insight InstallAnywhere InstallShield |
North America * |
+1 630-332-2513 (toll) +1 877-279-2853 (toll-free in North America) |
| Europe * |
+44 1925 944367 (toll) +44 800 047 8642 (toll-free in Europe) |
|
| Japan * | +81 3-4540-5335 (select option 2) | |
| Australia * |
+61 3 9895 2177 +61 1800 560 603 (toll-free in Australia) |
|
|
Usage Intelligence (formerly
Revulytics) Compliance Intelligence |
Please use the Case Portal to submit your support ticket or reach out to your Revenera contact. | |
Case id: 00001065
Activity: Status change: 2 hours ago