question

FahadNoaman-7438 avatar image
0 Votes"
FahadNoaman-7438 asked FahadNoaman-7438 commented

Create a powershell script to check what version of excel is install and set a report to open when excel start

Can you help me to build a script which will check the version of excel install using registry and set to open a application report where excel start.

windows-server-powershell
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi,
Is it Microsoft Office or Office 365? What do you mean by "application report"? An Excel spreadsheet?

0 Votes 0 ·

Hi Team,

its a xlam file needs to open and below registry to be created based on the excel version.
- create registry key to open AddIn when starting Excel:
Key: "HKCU\Software\Microsoft\Office\x.x\Excel\Options\OPEN" (x.x is version number)
Value: name of the found .xlam file
Type: "REG_SZ"

0 Votes 0 ·

1 Answer

IanXue-MSFT avatar image
0 Votes"
IanXue-MSFT answered FahadNoaman-7438 commented

Hi,

You can get the version of Office like this

 $version = Get-WmiObject -Class Win32_Product -Filter "name like 'Microsoft Office Professional%'" | Select-Object -ExpandProperty Version

If it's Office 365 you can try

 $version = Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Office\ClickToRun\Configuration' | Select-Object -ExpandProperty VersionToReport

To create a registry value you can use the New-ItemProperty cmdlet

 $version -match '\d+.\d'
 $ver = $Matches.Values
 New-ItemProperty -Path "HKCU:\Software\Microsoft\Office\$ver\Excel\Options" -Name "OPEN" -Value $filename -PropertyType String

Best Regards,
Ian Xue
============================================
If the Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

· 5
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello Lan Xue,

Thanks for the prompt help.

we use 0365 product.

I belive this script will not detect x64 bit registry.

"HKLM:Software\Wow6432Node\Microsoft\Office\11.0\Excel"

can you help me to create a check like this.

"HKLM:\SOFTWARE\Microsoft\Office\ClickToRun\Configuration' or this "HKLM:Software\Wow6432Node\Microsoft\Office\version\Excel"

0 Votes 0 ·

"HKLM:\Software\Wow6432Node" is for 32-bit applications that run on a 64-bit version of Windows.

0 Votes 0 ·

can you help me check for 32 bit as well..if in case we have any machine running office with 32 bit

0 Votes 0 ·
Show more comments