I am curious if anyone has a script they know of that has the ability to check what version of MS Office users have installed on their computers in order to compile a list of people running an older version who need to be upgraded.

I know the easiest way to retrieve the info would be to query HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* but the script I put together only works on one computer at a time.

foreach($computerin(Get-Content"c:\computers.txt")){write-verbose"Working on $computer..."-VerboseInvoke-Command-ComputerName"$Computer"-ScriptBlock{Get-ItemPropertyHKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\O365ProPlusRetail*|Select-ObjectDisplayName,DisplayVersion,Publisher}|export-csvC:\results.csv-Append-NoTypeInformation}

7 Replies

This person is a verified professional.

foreach($computerin(Get-Contentservers.txt)){$version=0$reg=[Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine',$computer)$reg.OpenSubKey('software\Microsoft\Office').GetSubKeyNames()|%{if($_-match'(\d+)\.'){if([int]$matches[1]-gt$version){$version=$matches[1]}}}if($version){"$computer : found $version"}else{"Could not find version for $computer"}}

foreach($computerin(Get-Content"c:\computers.txt")){write-verbose"Working on $computer..."-VerboseInvoke-Command-ComputerName"$Computer"-ScriptBlock{Get-ItemPropertyHKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\O365ProPlusRetail*|Select-ObjectDisplayName,DisplayVersion,Publisher}|export-csvC:\results.csv-Append-NoTypeInformation}