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
  • 相关阅读:
    053(二十五)
    053(二十四)
    053(二十三)
    053(二十二)
    053(二十一)
    053(二十)
    053(十九)
    053(十八)
    053(十七)
    单例设计模式
  • 原文地址:https://www.cnblogs.com/fengwenit/p/3468362.html
Copyright © 2011-2022 走看看