PowerShell Script to Delete a specific update from WSUS


 

At time troubleshooting on cases we had to delete a specific update from the WSUS and we had done it through deleting it from database which is not a safe method.

This is also helpful at times when you want to remove a specific update and re-import the same from catalogue without a full clean up and sync

================================================================

#Change server name and port number and $True if it is on SSL
[String]$updateServer1 = "CMCAS"
[Boolean]$useSecureConnection = $False
[Int32]$portNumber =8530
#updateid (GUID of the update)to delete
$deleteupdate = "033189f3-6004-48f2-82f4-8d7fca20276d"
# Load .NET assembly
[void][reflection.assembly]::LoadWithPartialName("Microsoft.UpdateServices.Administration")
# Connect to WSUS Server
$updateServer = [Microsoft.UpdateServices.Administration.AdminProxy]::getUpdateServer($updateServer1,$useSecureConnection,$portNumber)
write-host "<<<Connected sucessfully >>>" -foregroundcolor "yellow"
$updatescope = New-Object Microsoft.UpdateServices.Administration.UpdateScope
$u=$updateServer.GetUpdates($updatescope )
foreach ($u1 in $u )
{
$a=New-Object Microsoft.UpdateServices.Administration.UpdateRevisionId
$a=$u1.id

if ($a.UpdateId -eq $deleteupdate)

     write-host "Deleting update " $a.UpdateId "..."
      $updateServer.DeleteUpdate($a.UpdateId)
}

}

trap
{
write-host "Error Occurred"
write-host "Exception Message: "
write-host $_.Exception.Message
write-host $_.Exception.StackTrace
exit
}
# EOF

==============================================================

 

This posting /Script  is provided "AS IS" with no warranties and confers no rights


Comments (3)

Cancel reply

  1. wengdongdong says:

    20151225dongdong
    http://www.christianlouboutinoff.us

    http://www.fitflopuk.me.uk
    http://www.chaussurelouboutin-pascher.fr

    http://www.juicy-couture.us
    http://www.hermesuk.org.uk
    http://www.monclerjacketsoutlet.us.com

    http://www.tomswedges.in.net
    http://www.nikerosheruns.me.uk
    http://www.nike-airmax.org.uk
    http://www.mymichaelkorssoutlets.org

    http://www.raybansoutlet.in.net
    http://www.nikecortez.com.co
    http://www.runningshoes.com.co
    http://www.coachfactoryoutletus.in.net

    http://www.adidas-shoes.me.uk
    http://www.pandorajewelryoutlet.name

    http://www.louisvuitton-borse.it
    http://www.michaelkorsoutletforus.com

    http://www.gucci-borse.it
    http://www.cheapuggs-boots.in.net

    http://www.nike-airmax90.me.uk
    http://www.nikestoreuk.me.uk
    http://www.quality-outlet.com
    http://www.canadagooseoutlet.cc
    http://canadagoose.outletmalls.us.com

    http://www.nikefreeruns.uk
    http://www.mcmoutlet.us
    http://www.nikesb.uk
    http://www.michael-kors-handbags.uk

    http://www.coachoutletonlinespick.org

    http://www.instylermax.in.net
    http://www.airforce1-nike.fr
    http://sunglasses.outletmalls.us.com

    http://www.guccioutlet.net.co
    http://www.michaelkorsoutletoff.in.net

    http://www.michaelkorshandbags.cc

    http://www.coachoutlet-storeonline.in.net

    http://www.michael-korsuk.me.uk
    http://burberry.outletmalls.us.com

    http://www.toryburchoutlet-sale.in.net

    http://www.top-coachoutletstore.org

    http://www.truereligion-outlet.in.net

    http://www.authenticlouisvuittonhandbags.net

    http://www.airjordan-pascher.fr
    http://www.adidasshoes.name
    http://www.ugg-boots-store.com
    http://www.kate-spadeoutlet.com.co

    http://www.tommyhilfiger.in.net
    http://www.basketballshoes.net.co

  2. cheap michael kors says:

    cheap jordans, http://www.cheap-jordans.net/
    cheap michael kors, http://www.cheapmichaelkors.us.org/
    nike shoes, http://www.cheap-nikeshoes.com/
    cheap oakley sunglasses, http://www.cheapoakley.us.org/
    cheap oakley , http://www.cheapoakleysunglasses.co.com/
    cheap oakley sunglasses, http://www.cheap-oakleysunglasses.in.net/
    cheap ray ban, http://www.cheaprayban.com.co/
    boots on sale, http://www.cheapshoes.com.co/
    cheap ugg boots, http://www.cheapuggboots.eu.com/
    flat iron, http://www.chiflatiron.net.co/
    christian louboutin, http://www.christian–louboutin.in.net/
    louboutin shoes, http://www.christianlouboutin.org.uk/
    christian louboutin shoes, http://www.christianlouboutinshoes.jp.net/
    coach outlet online, http://www.coachfactory-outlet.co.com/
    coach factory, http://www.coachfactoryoutletonline.co.com/
    coach outlet usa, http://www.coach-handbags.com.co/
    coach outlet, http://www.coachoutlet-online.com.co/
    coach store online, http://www.coachoutletstore.net.co/
    coach outlet, http://www.coachoutletstore-online.com.co/
    chanel sunglasses, http://www.coco-chanelbags.com.co/
    converse shoes, http://www.converse.net.co/
    coach handbags, http://www.designerhandbagsoutlet.com.co/
    eyeglasses online, http://www.eyeglassesonline.us.com/
    eyeglass frames, http://www.eyeglassframes.us.com/
    burberry clothes, http://www.fashion-clothing.us.com/
    salvatore ferragamo, http://www.ferragamo.com.co/
    ferragamo shoes, http://www.ferragamoshoes.net/
    hair straightener, http://www.ghdhairstraightener.com.co/
    gucci shoes outlet, http://www.gucci.me.uk/
    gucci handbags, http://www.guccihandbags.com.co/
    gucci factory, http://www.gucci-outlet.in.net/
    gucci outlet, http://www.gucci–outlet.in.net/
    gucci shoes, http://www.guccishoes.net.co/
    gucci shoes, http://www.guccishoes.us.org/
    hermes, http://www.hermesbags.com.co/
    hermes birkin, http://www.hermesbirkin.com.co/
    hermes outlet online, http://www.hermesoutlet.net.co/
    hollister, http://www.hollister.us.org/

Skip to main content