系统相关
首页 > 系统相关> > Power shell -- Get-installedsoftwares

Power shell -- Get-installedsoftwares

作者:互联网

 

function Get-InstalledSoftwares
{
   
    function ConvertTo-ProductEntity
    {
        param([Microsoft.Win32.RegistryKey]$RegKey)
        $product = '' | select Name,Publisher,Version
        $product.Name =  $_.GetValue("DisplayName")
        $product.Publisher = $_.GetValue("Publisher")
        $product.Version =  $_.GetValue("DisplayVersion")

        if( -not [string]::IsNullOrEmpty($product.Name)){
            $product
        }
    }

    $UninstallPaths = @(,
 
    'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall',
  
    'HKCU:\Software\Microsoft\Windows\CurrentVersion\Uninstall')

    
    if([Environment]::Is64BitOperatingSystem) {
        $UninstallPaths += 'HKLM:SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall'
    }
    $UninstallPaths | foreach {
        Get-ChildItem $_ | foreach {
            ConvertTo-ProductEntity -RegKey $_
        }
    }
}

  

 

标签:Publisher,product,shell,Name,Get,--,installedsoftwares,GetValue,Microsoft
来源: https://www.cnblogs.com/xxllx/p/15935927.html