Getting version of MS Office installed on all domain computers

Welcome Forums General PowerShell Q&A Getting version of MS Office installed on all domain computers

Viewing 4 reply threads
  • Author
    Posts
    • #265211
      Participant
      Topics: 3
      Replies: 4
      Points: 54
      Rank: Member

      Hello,

      The organization I work for is currently in the process of moving from on-prem Exchange to Office 365.
      In order to do that, we need to identify which user uses what version of MS Office.
      I found the following script that I think it supposed to work properly.

      foreach ($computer in (Get-Content “c:\computers.txt”)){
      write-verbose “Working on $computer…” -Verbose
      Invoke-Command -ComputerName “$Computer” -ScriptBlock {
      Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\O365ProPlusRetail* |
      Select-Object DisplayName, DisplayVersion, Publisher
      } | export-csv C:\OfficeVersionResultsByComputer.csv -Append -NoTypeInformation
      }

      I ran it but then I get red carpet all over my screen saying the WinRM service is not running. I thought maybe it is running on a few computers, but no, I got an empty .csv file.

      I know I can bulk enable the WinRM service, but I don’t want to go that route.
      Here are my requirements:

      • Check connectivity to the computer (from a .txt or .csv file), skip if offline or otherwise unreachable
      • Enable the WinRM service on that computer
      • Check installed Office version and write it to the C:\OfficeVersionResultsByComputer.csv file
      • Disable the WinRM service
      • Move on to the next computer

      How can I achieve that in one script?

      Thank you,

      • This topic was modified 1 month, 1 week ago by 85xlt75.
    • #265268
      Participant
      Topics: 2
      Replies: 380
      Points: 513
      Helping Hand
      Rank: Major Contributor

      Don’t script it, use the Microsoft Assessment and Planning (MAP) Toolkit.

      https://docs.microsoft.com/en-us/previous-versions//bb977556(v=technet.10)?redirectedfrom=MSDN

       

      • This reply was modified 1 month, 1 week ago by Matt Bloomfield. Reason: URL Formatting
    • #265499
      Participant
      Topics: 3
      Replies: 4
      Points: 54
      Rank: Member

      Hi Matt,

      I used the Microsoft Assessment and Planning (MAP) Toolkit. It seems to provide inaccurate information.
      Is it possible to do it with PowerShell instead? Can you tell me how to proceed with it?

      Thank you,

    • #265541
      Participant
      Topics: 2
      Replies: 380
      Points: 513
      Helping Hand
      Rank: Major Contributor

      If you don’t want to use a GPO to enable WinRM then without 3rd party tools you’ll need to use psexec from the SysInternals suite.

      1. Import your list of computers with Get-Content
      2. Use a foreach loop to process the list of computers
        1. Use Test-NetConnection to see if the computer is online
        2. Use psexec to connect to the computer and enable WinRM
        3. Use Test-WSMan to confirm WinRM is running on the remote machine
        4. Run your script to gather required information
        5. Use psexec to connect to the computer and disable WinRM
    • #265571
      Participant
      Topics: 9
      Replies: 676
      Points: 2,674
      Helping Hand
      Rank: Community Hero

      If allowed through the firewall, you could also use remote registry to query the values. I wrote a function that will enable/start remoteregistry if needed, gather the information, and then set the remoteregistry service back to how it was set previously. Feel free to use it if you like.

      https://github.com/krzydoug/Tools/blob/master/Get-InstalledPrograms.ps1

      Note the parameter Name is the name of the computer not program. I used that so it would accept the output of Get-ADComputer as pipeline input without having to extract the name first. Unfortunately the default .ToString() on ADComputer object provides it’s distinguished name. 🙁

      The function includes examples. To check for office you could use something like this

      Then you can take whatever properties out of $OfficeInstalls that you like and export to csv.

Viewing 4 reply threads
  • You must be logged in to reply to this topic.