xud6的笔记本
  • 主页
  • Centos
  • SELinux
  • FreeIPA
  • node.js
  • ember.js
  • Hyper-V
  • Windows
  • Embedded
  • Linux
  • 树莓派
  • MACOS
Subscribe
Tagged

powershell

A collection of 2 posts

windows

Powershell 卸载程序

function Uninstall-Application { $appName = $($args[0]) Write "application to uninstall: $appName" $uninstall32 = gci "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall" | foreach { gp $_.PSPath } | ? { $_ -Match $appName } $uninstall64 = gci "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" | foreach { gp $_.PSPath } | ? { $_ -match $appName } if($uninstall32){ if($uninstall32.QuietUninstallString){ Write ("

  • xud6
xud6 2020年11月9日 • 1 min read
powershell

Powershell 操作 windows更新

定义更新搜索 $Criteria = "IsInstalled=0 and Type='Software'" 搜索可用的更新 $Searcher = New-Object -ComObject Microsoft.Update.Searcher $SearchResult = $Searcher.Search($Criteria).Updates 下载更新 $Session = New-Object -ComObject Microsoft.Update.Session $Downloader = $Session.CreateUpdateDownloader() $Downloader.Updates = $SearchResult $Downloader.Download() 安装更新 $Installer = New-Object -ComObject Microsoft.Update.Installer $Installer.Updates = $SearchResult $Result = $Installer.Install() 检查是否需要重启

  • xud6
xud6 2019年7月8日 • 1 min read
xud6的笔记本 © 2022
Powered by Ghost