none
How to Detect MS Office Install directory path using PowerShell2.0 Script(Win 7 32bit)? RRS feed

  • Question

  • Hi,

    How to Detect MS Office Install directory path using PowerShell 2.0 Script(Win 7 32bit)?

    I'm Using this Script to find Install Directory But not Working :(

    $computer ='.'
    $Option =Get-WmiObject -Protocol DCOM
    $Session = New-CimSession -ComputerName $computer -SessionOption $Option
    $office=Get-CimInstance -ClassName CIM_Product -CimSession $Session |Where-Object {$_.Name -Like "Microsoft Office*" }| Select-Object -first 1
    $officeVersion=[int]$office.Version.Split('.')[0]
    $officePath = $office.InstallLocation+"Office"+ $officeVersion + "\"
    cd $officePath

    it's use PS 3.0

    please Helpme

    thanks

    • Moved by Bill_Stewart Tuesday, December 5, 2017 3:22 PM Abandoned
    Wednesday, November 1, 2017 6:26 AM

All replies

  • I'm Using this Script to find Install Directory But not Working :(

    What exactly is not working? Do you get errors? If yes - show it!

    And please - use the code posting tool from the edit bar when you post code or error messages.
    Thanks.


    Best regards (79,108,97,102|%{[char]$_})-join''

    Wednesday, November 1, 2017 3:26 PM
  • This should work actually:
    $computer ='.'
    $office = Get-WmiObject -Class WIN32_Product -ComputerName $computer | Where-Object {$_.Name -Like "Microsoft Office*" }| Select-Object -first 1
    $officeVersion=[int]$office.Version.Split('.')[0]
    $officePath = $office.InstallLocation+"Office"+ $officeVersion + "\"


    Best regards (79,108,97,102|%{[char]$_})-join''

    Wednesday, November 1, 2017 3:34 PM