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
  • 相关阅读:
    Git学习笔记06-版本回退
    python3+selenium入门07-元素等待
    [cerc2017J]Justified Jungle
    [codeforces126B]Password
    计算几何基础模板
    floyd路径记录
    [数据结构复习]层序建立二叉树
    [patl2-011]玩转二叉树
    [poj3348]Cows
    [poj3347]Kadj Squares
  • 原文地址:https://www.cnblogs.com/fengwenit/p/3468362.html
Copyright © 2011-2022 走看看