sticky
如何判斷 Visio/Project 2019 and 2021 RRS feed

  • 一般討論

  • Type: Feature

    問題說明 : 如何判斷 Visio/Project 2019 and 2021

    處理方式 : Office 相關產品安裝後可以在以下機碼中找到相對應的版本資訊

    64位元:

    Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall

    32位元:

    Computer\HKEY_LOCAL_MACHINE \SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall


    在該機碼中可以看到安裝的資訊,如上可以看到安裝的是 2019 VISIO

    您可以透過以下 powershell function 來檢查對應機碼位置是否有 2019 2021 visio project

    # check2019Exists ----------------------------------------------------------
    #
    # Check If visio2019 and project2091 exists
    #
    #-------------------------------------------------------------------------
    function check2019Exists
    {
        $RegPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall", "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall"
        $visioapp = Get-ChildItem -Path $RegPath | Get-ItemProperty | Where-Object {$_.DisplayName -match "visio" -and $_.DisplayName -match "2019"}
        if($visioapp)
        {
            write-host "Visio2019 already exists" -ForegroundColor Yellow
        }
    
        $projectapp = Get-ChildItem -Path $RegPath | Get-ItemProperty | Where-Object {$_.DisplayName -match "project" -and $_.DisplayName -match "2019"}
       if($projectapp)
        {
            write-host "Project2019 already exists " -ForegroundColor Yellow
        }
    
    
    }
    
    
    # check2021Exists ----------------------------------------------------------
    #
    # Check if visio2021 and project exist
    #
    #-------------------------------------------------------------------------
    function check2021Exists
    {
        $RegPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall", "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall"
        $visioapp = Get-ChildItem -Path $RegPath | Get-ItemProperty | Where-Object {$_.DisplayName -match "visio" -and $_.DisplayName -match "2021"}
        if($visioapp)
        {
            write-host "Visio2021 already exists" -ForegroundColor Yellow
        }
        
    
        $projectapp = Get-ChildItem -Path $RegPath | Get-ItemProperty | Where-Object {$_.DisplayName -match "project" -and $_.DisplayName -match "2021"}
        if($projectapp)
        {
            write-host "Project2021 already exists " -ForegroundColor Yellow
        }
    }
    
    
    check2019Exists
    check2021Exists
    
    



    如果帖子有帮到您的话,请点击左上方“投票”按钮。这将帮助到阅读这个帖子的其他用户。

    2022年9月7日 上午 06:28