zoukankan      html  css  js  c++  java
  • powershell:卸载计算机软件

    $ComputerName = hostname
    Function Get-NonMSIApplication($productDisplayname) 
    {
        $Msg="无软件"+$productDisplayname
        $regPathX86 = 'HKLM:SoftwareMicrosoftWindowsCurrentVersionUninstall'
        $regPathX64 = 'HKLM:SOFTWAREWow6432NodeMicrosoftWindowsCurrentVersionUninstall'
        $regPath = ($regPathX64,$regPathX86)
        Get-ChildItem ( foreach { $regPath})| foreach { 
            $product =  Get-ItemProperty $_.PSPath
             if($product.DisplayName -like ('*'+$productDisplayname+'*') )
                {
                 $Msg=""
                 $product.UninstallString = $product.UninstallString + " /quiet /norestart"
                Start-Process  (cmd /c $product.UninstallString ) -Wait
                 if((Test-Path $_.PSPath ))
                    { 
                       $Msg = $Msg + '卸载'+ $product.DisplayName +'软件失败'+"|"
                     }
                 else
                    {
                      $Msg = $Msg + '卸载'+ $product.DisplayName +'软件成功'+"|"
                     }
                }
      }
        $Path="\V12CNDCZ01DCSP2	mpSoftwareList"+ $ComputerName +".txt"  
        #Write-Output $Msg|Out-File -filepath $Path
        $Msg >>$Path
    }
    import-csv -path .Blacklist.csv -UseCulture |ForEach-Object { Get-NonMSIApplication $_.blacklist}
    

      

  • 相关阅读:
    hdu 2147博弈找规律
    hdu 1851 巴什博弈
    hdu 1729 sg博弈
    hdu 2516博弈找规律
    (转载)博弈之SG函数
    poj 2234基础Nim博弈||sg博弈
    hdu 1730 sg博弈||nim博弈
    hdu 1847 博弈找规律
    n hdu 1760 [SG博弈]二维状态
    hdu 1849 nim博弈
  • 原文地址:https://www.cnblogs.com/vmsky/p/13698719.html
Copyright © 2011-2022 走看看