PowerShell Script to check file version across the network

Our office runs an application that is constantly being updated.  Unfortunately the program is not easy to update via Group Policy (GPO), so instead of walking to each computer to check if it needs an upgrade or if it is running multiple versions, I wrote this script to do the legwork for me.  To modify this script simply change <ProgramVersions> <ProgramFolder> and <ProgramFile> to suit your needs.  You will also need to modify the  $LogFile variable to a path that exists on your own system.  It can take some time to run, especially if you have a lot of systems to check.  The end result is a log file that tells you where to find what you are looking for so you can work more efficiently.

# I like a tidy workspace

# Errors happen, just move on.  Comment this out if you want to see what broke.
$ErrorActionPreference = "silentlycontinue"

# Make a log,  
$LogTime = Get-Date -Format "MM-dd-yyyy_hh.mm.ss"
$LogFile= 'C:\work\<ProgramVersions>.'+$logtime+'.txt'
$logtime | Out-File $LogFile

# Need this to discover what computers are on the network
Import-Module ActiveDirectory
$computer = (Get-ADComputer -Filter 'ObjectClass -eq "Computer"' | Select -Expand DNSHostName)

$drawline=  "-----------------------------------------------------------------------------------------------------------------------"

# Get that list of computers and do something with it.

foreach ($computer1 in $computer) {

# Define what we are looking for

# The program we are looking for may have multiple instances.  Here's another possible location.

# Go find what we are looking for and log it.
if ((Get-ChildItem -Recurse $FilePath) -eq $null){

else {
$drawline | Tee-Object $LogFile -Append
$computer1 | Tee-Object $LogFile -Append
Get-ChildItem  -Recurse $FilePath | foreach-object { "{0,-80}`t{1}" -f $_.FullName,  [System.Diagnostics.FileVersionInfo]::GetVersionInfo($_).FileVersion } |  Tee-Object $LogFile -Append
Get-ChildItem -Recurse  $FilePath2 | foreach-object { "{0,-80}`t{1}" -f $_.FullName,  [System.Diagnostics.FileVersionInfo]::GetVersionInfo($_).FileVersion }   | Tee-Object $LogFile -Append

$drawline| Tee-Object $LogFile -Append