Browsing Category: "Patches"

Forcing Windows Updates with PowerShell

Patches, Scripting December 10th, 2007

Lately, I have had to set up a number of computers from scratch (I know, I know, I should have updated my base image, but I didn’t…). As I was setting up the computers, I wanted to make sure their patch level was current.

Going to Windows Update (Microsoft Update) showed around 91 updates to download. I said to myself, “Self, I already downloaded all these updates to my Windows Server Update Services server. Isn’t there an easy way to make this computer update from there?”

In my environment, the location of the computer determines what Organizational Unit it is in my Active Directory, which in turn, says when it is scheduled to download updates.

A short Google search later, and I found a batch file which will cause a client computer to check with a local WSUS server (or MS Update if there is not an assigned local server) at Patchaholic – the WSUS Blog!

Since I’m a PowerShell fan, I though I should translate this simple batch file to PowerShell (and give it a more PowerShelly name).

#* FileName: Invoke-WindowsUpdate.ps1
#*================================================================
#* Script Name: [Invoke-WindowsUpdate]
#* Created: [12/10/07]
#* Author: Steven Murawski
#* Company:
#* Email: steve@acoupleofadmins.com
#* Web: http://www.acoupleofadmins.com
#* Reqrmnts:
#* Keywords:
#*===============================================================
#* Purpose: This script will force a computer to check for updates from
#* Microsoft Update or a local WSUS Server. This script is the
#* PowerShell version of the batch file found at Patchaholic – The WSUS Blog
#* http://msmvps.com/blogs/athif/pages/66375.aspx
#*===============================================================

Write-Host “This PowerShell script will Force the Update Detection from the AU client:”
Write-Host “1. Stops the Automatic Updates Service (wuauserv)”
Write-Host “2. Deletes the LastWaitTimeout registry key (if it exists)”
Write-Host “3. Deletes the DetectionStartTime registry key (if it exists)”
Write-Host “4. Deletes the NextDetectionTime registry key (if it exists)”
Write-Host “5. Restart the Automatic Updates Service (wuauserv)”
Write-Host “6. Force the detection”
Read-Host “Press enter to continue”

# Stop the local Windows Update Service
Stop-Service wuauserv

# Set the location of registry key
$AutoUpdate = “HKLM:\Software\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update”

# PowerShell allows you to navigate the registry like a drive
# The various registry hives are like drives, the keys are like files
# and their values are shown as properties.

# The switch statement below checks to see if any of the values below are set and deletes them
# if they are present.
switch (Get-ItemProperty $AutoUpdate)
{
{$_.LastWaitTimeout} {Remove-ItemProperty -Path $AutoUpdate -name LastWaitTimeout}
{$_.DetectionStartTime} {Remove-ItemProperty -Path $AutoUpdate -name DetectionStartTime}
{$_.NextDetectionTime} {Remove-ItemProperty -Path $AutoUpdate -name NextDetectionTime}
}

# Restart the local Windows Update Service
Start-Service wuauserv

# Call the command line client to check for new updates
wuauclt /detectnow

Write-Host “This AU client will now check for the Updates on the Local WSUS Server.”
Read-Host “Press enter to continue”

Translating this script was good, as it allowed me to work hands-on with the registry through PowerShell, which I had not yet had an opportunity to do.

Invoke-WindowsUpdate.ps1

ForceUpdate.bat

Episode 15 – Now With Teflon!

Geek Stuff, General Interest, Patches, Podcast, Rants, Security, SPAM, Wiki September 5th, 2007

Recorded: September 4, 2007

Your Hosts: Keith Albright, Rich Niemeier, Ted Miller, and Steve Murawski

 

Show Length: 1:50:33
Ted returns this week for a regular format show. We discuss some recent news items; Microsoft shuts down AutoPatcher, SpamHaus gets a legal reprieve, and Sony introduces rootkit 2.0. Rich discusses the appropriateness of companies editing their Wikipedia articles and a look into the future of video on the Internet. Steve discusses employees Cyberslacking habits and the effect on companies. We end with our website picks and as usual, we hope you enjoy.

A reminder for Podcamp Philly. Keith will definitely be there on Saturday and possibly Sunday. Drop him a note at Keith [at] acoupleofadmins.com if you want to meet up for lunch.
Links mentioned in this show:

Other podcasts mentioned in this show:

Valid Syntax

See the full show notes here.

Website Picks:

Steve’s Pick: www.diigo.com

Keith’s Pick: www.digibarn.com

Rich’s Pick: www.livecdlist.com

Ted’s Pick (By Rich): www.flock.com

Listen Now:

Download Here

Episode 12 – It’s Pronounced Kickstart

Automation, Desktops, General Interest, Networking, OLPC, Patches, Servers, SPAM August 18th, 2007

Recorded: August 14, 2007
Your Hosts: Keith Albright and Rich Niemeier

Show Length: 1:33:58

Sorry it took so long to edit and post. I took a couple vacation days and didn’t get to do the final steps.

Just Rich and I this episode…..unless you count ‘Virtual Ted’. Rich and I cover the usual gamut of news topics; Novell/SCO Unix lawsuit, Google’s 700Mhz Spectrum bid, and a NJ beach town’s plans to be the next technological marvel. Rich uncovers follow-up information about the health-risks of laser printers. We discuss what Apple can do to help with lost/stolen iPods and how to audit USB device usage on your network. We end with our website picks and as usual, we hope you enjoy.
Links mentioned in this show:

Other podcasts mentioned in this show:

None

See the full show notes here.

Website Picks:

Keith’s Pick: NPA Lookup Tool

Rich’s Pick: New video site – VBS.TV

Listen Now:

Download Here

Episode 5 – Digital Evidence

Feedback, OLPC, Patches, Podcast, Security May 30th, 2007

Recorded: May 5, 2007
Your Hosts: Keith Albright and Rich Niemeier
Show Length: 1:20:48

Rich discuss the recent changes to the Federal Rules of Criminal Procedure and how it affects IT. Collection of digital evidence and compliance with discovery orders are discussed. Real live listener feedback and a brief discussion on choosing and changing a password. Take a listen and we hope you enjoy.

Thanks everyone.

Links mentioned in this podcast:

Website Picks:

Keith’s Pick: Computer History Museum

Rich’s Pick: Wikipedia

Listen Now:

Download Here

MS Outlook 2007 Update

Patches, Security April 25th, 2007

I gleaned this one from the “Windows Weekly with Paul Thurrott” podcast……  Apparently there was an update released for MS Outlook 2007 to fix a problem with calendar items marked private, but the bonus is that it improves performance of Outlook significantly.

Update for Outlook 2007 (KB933493)

I applied the patch and did notice an improvement. Would I call it significant; not really.  But, I am also currently running Office 2007 on an AMD Sempron 2600 box.  Nothing is running all that great on this system anyway. This is the same system on which I had to put blackhole entries for two servers at Microsoft so that my system wasn’t constantly utilizing resources to “phone home”.  By the way, those hosts are as follows:

127.0.0.1              config.officebeta.microsoft.com 

127.0.0.1              microsoftofficesystem.org

Something about the use of the word BETA in the FQDN freaks me out. I’d be interested to know if anyone else is having this problem.

Check it out if you are running Outlook 2007 and let me know if you are finding better results than I am.

Keith

Microsoft Patches

Automation, Desktops, Patches, Scripting, Security April 25th, 2007

A quick note on a couple of recent Microsoft patches that you might find relevant.

If you have installed the Microsoft MS07-017 (KB925902) patch and had a problem with your systems receiving the following errors:

application_executable_name – Illegal System DLL Relocation

The system DLL user32.dll was relocated in memory. The application will not run properly. The relocation occurred because the DLL C:\Windows\System32\Hhctrl.ocx occupied an address range reserved for Windows system DLLs. The vendor supplying the DLL should be contacted for a new DLL.

Check out the following MS Knowledgebase article and related patch.  I’ve downloaded the patch and applied it successfully to my systems with the Realtek Audio software.

MS Knowledgebase Article 935448

Update for WindowsXP (KB935448)

I use the Kixtart scripting language for my login scripts, so it was easy to deploy the original patch as well as the follow-up Realtek patch using the following script:

AT ( 1,1) “A critical security patch is needed on your computer.”
AT ( 2,1) “Please wait while your system is updated……..”

IF EXIST (“C:\WINNT\$NtUninstallKB925902$”) OR EXIST (“C:\WINDOWS\$NtUninstallKB925902$”)
             AT (4,1) “Microsoft Exploit Patch already applied”
             IF EXIST (“C:\WINNT\$NtUninstallKB935448$”) OR EXIST (“C:\WINDOWS\$NtUninstallKB935448$”)
                          AT (6,1) “Realtek Patch Already Applied”
             ELSE
                          IF @producttype = “Windows XP Professional”
                              AT (6,1) “Installing Realtek Patch…..”
                              SHELL “\\DOMAINCONTROLLER\NETLOGON\PATCHES\KB935448.exe /QUIET /NORESTART”
                          ENDIF
             ENDIF

ELSE
             if @producttype = “Windows 2000 Professional”
                AT (4,1) “Patching Windows 2000 Professional…….”
                SHELL “\\DOMAINCONTROLLER\NETLOGON\PATCHES\2000.EXE /QUIET /NORESTART”
             endif

             if @producttype = “Windows XP Professional”
                AT (4,1) “Patching WindowsXP Professional……..”
                SHELL “\\DOMAINCONTROLLER\NETLOGON\PATCHES\XP.EXE /QUIET /NORESTART”
             endif

ENDIF
AT (8,1) “Your system has been patched.”

Hopefully you find this useful. 

Oh, and if you are not using a robust scripting language, you should check out KiXstart.  It’s released as CareWare, so please do your part and make a donation to one of the listed organizations.

KiXtart website

Keith

blank