zoukankan      html  css  js  c++  java
  • Powershell script to install Windows Updates (msu) from folder

    #########################################################
    #
    # Name: InstallWindowsUpdates.ps1
    # Author: Tony Murray
    # Version: 1.0
    # Date: 16/11/2010
    # Comment: PowerShell script to install 
    # Windows Update files
    #
    #########################################################
    
    # Specify the location of the *.msu files
    $updatedir = "C:E2010 SP1 Prereqs"
    ###
    
    $files = Get-ChildItem $updatedir -Recurse
    $msus = $files | ? {$_.extension -eq ".msu"}
    
    foreach ($msu in $msus)
    {
        write-host "Installing update $msu ..."
        $fullname = $msu.fullname
        # Need to wrap in quotes as folder path may contain spaces
        $fullname = "`"" + $fullname + "`""
        # Specify the command line parameters for wusa.exe
        $parameters = $fullname + " /quiet /norestart"
        # Start wusa.exe and pass in the parameters
        $install = [System.Diagnostics.Process]::Start( "wusa",$parameters )
        $install.WaitForExit()
        write-host "Finished installing $msu"
    }
    
    write-host "Restarting Computer"
    #Restart-Computer
  • 相关阅读:
    es6.8集群部署(ssl认证)+nfs备份(生产)
    spool
    dataguard unname
    zabbix监控mysql主从同步可用性
    企业微信发送消息
    安装ruby
    binlog2sql
    xtrabackup备份异地恢复+binlog日志应用
    5.7.29重新部署主从
    centos7 图形界面启动
  • 原文地址:https://www.cnblogs.com/fengwenit/p/3468362.html
Copyright © 2011-2022 走看看