MikeWilliams_UK

Find Word Installations

Apr 17th, 2021 (edited)
346
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. cls
  2. $drives = Get-PSDrive -PSProvider 'FileSystem'
  3.  
  4. foreach($drive in $drives) {
  5.     if ($drive.DisplayRoot -eq $null)
  6.     {
  7.         Write-Host "Searching local drive $($drive.Root)"
  8.         $files = Get-ChildItem -File -Path $drive.Root -Recurse -Filter WINWORD.exe -ErrorAction SilentlyContinue
  9.         foreach ($file in $files)
  10.         {
  11.             Write-Host "  Found Version $($file.VersionInfo.FileVersion) at $($file.VersionInfo.FileName)"
  12.         }
  13.     }
  14.     else
  15.     {
  16.         Write-Host "Skipping network drive $($drive.Root) $($drive.DisplayRoot)"
  17.     }
  18. }
Add Comment
Please, Sign In to add comment