locked
Find files on WSUS directory RRS feed

  • Question

  • Hello, dear colleagues

    I want to find already downloaded Update in the WsusContent folder by list (csv or txt)
    Cant find function for get information about file location

    Need somthing like this

    Get-UpdateLocation -name "Security Update for Windows Server 2012 R2 (KB3067505)"
     > D:\Wsus\WsusContent\04\ASD123DSFWRY4G357FDSV8.EXE


    The opinion expressed by me is not an official position of Microsoft

    Monday, October 26, 2015 1:22 PM

Answers

All replies

  • Hi,

    You've checked the repository?

    http://gallery.technet.microsoft.com/scriptcenter


    Monday, October 26, 2015 1:29 PM
  • first thing I did is checking gallery and google

    last something like this worked on windows server 2003 (in my case I have 2012r2 server)

    Old script is here but it doesn`t work 


    The opinion expressed by me is not an official position of Microsoft

    Monday, October 26, 2015 1:40 PM
  • Okay.

    You'll need to post your current script and ask a specific question then.


    Monday, October 26, 2015 1:50 PM
  • I try this

    $updateSession = new-object -com "Microsoft.Update.Session"
    $criteria="Name='Security Update for Windows Server 2012 R2 (KB3067505)'"  
    $updates=$updateSession.CreateupdateSearcher().Search($criteria).Updates
    $downloader = $updateSession.CreateUpdateDownloader()           
    $Updates |Select -First 1 | foreach {$_.Title}
    $downloader.Updates = $Updates 

    and got nothing (only 2 errors)

    Exception calling "Search" with "1" argument(s): "Exception from HRESULT: 0x80240032"
    At line:4 char:1
    + $updates=$updateSession.CreateupdateSearcher().Search($criteria).Updates
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
        + FullyQualifiedErrorId : ComMethodTargetInvocation
     
    Exception setting "Updates": "Type mismatch. (Exception from HRESULT: 0x80020005 (DISP_E_TYPEMISMATCH))"
    At line:7 char:1
    + $downloader.Updates = $Updates
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (:) [], SetValueInvocationException
        + FullyQualifiedErrorId : CatchFromBaseAdapterSetValueTI
     

    So i have a question: how I can find file location (or copy it to different folder) on WSUS? (I hope it specific question)

    I do not need to reed information from files, using foreach, try/catch... I need only one method or function

     

    The opinion expressed by me is not an official position of Microsoft



    • Edited by Vector BCO Monday, October 26, 2015 3:23 PM
    Monday, October 26, 2015 3:20 PM
  • You could try the cmdlet:

    $Guid = 'Put GUID of Update here'
    (Get-WSUSUpdate -UpdateId $Guid).Update | Format-List

    You'll need to find out the GUID of the update you're interested in and set it in the $Guid variable without braces {}. You should be able to find the GUID of the update in the WSUS UI somewhere. Sorry I can't be more specific here, but I don't have access to my WSUS server right now.

    The command should return all properties of the Update object for the update, one of which will be the path the update is stored.

    HTH

    Tuesday, October 27, 2015 2:32 AM
  • Hello everyone

    i found information about GUID and many other properties, but cant find information about file location on WSUS server

    Now i have something like this

    $updateSession = new-object -com "Microsoft.Update.Session" 
    Write-progress -Activity "Updating" -Status "Checking available updates" 
    $criteria="type='software'"
    $updates=$updateSession.CreateupdateSearcher().Search($criteria).Updates 
    $downloader = $updateSession.CreateUpdateDownloader()           
    $Updates |Where {$_.Title -eq 'Security Update for Windows Server 2012 R2 (KB3067505)'} | foreach {
    "~~~~~~~~~~~~ Identity (GUID) ~~~~~~~~~~~~"
        $_.Identity.UpdateID
    "~~~~~~~~~~~~ IsDownloaded ~~~~~~~~~~~~"
        $_.IsDownloaded
    "~~~~~~~~~~~~ MoreInfoUrls ~~~~~~~~~~~~"
        $_.MoreInfoUrls
    "~~~~~~~~~~~~ SecurityBulletinIDs ~~~~~~~~~~~~"
        $_.SecurityBulletinIDs
    "~~~~~~~~~~~~ SupersededUpdateIDs ~~~~~~~~~~~~"
        $_.SupersededUpdateIDs
    "~~~~~~~~~~~~ KBArticleIDs ~~~~~~~~~~~~"
        $_.KBArticleIDs
    }

    It's work fine but without information what i need

    I also try

    $Guid = '33cd6b5a-f5a8-4d2d-b163-96e155eed7b9'

    # In my case i use $_.Identity.UpdateID from fist sample
    (Get-WSUSUpdate -UpdateId $Guid).Update | Format-List

    but receive the same information

    Any ideas?



    The opinion expressed by me is not an official position of Microsoft

    Tuesday, October 27, 2015 3:56 PM
  • Can anyone help me?
    Help me please with my problem

    (?) Please keep in mind that questions in this forum are answered by volunteers, and as such there is no SLA that guarantees that someone will be able to solve your problem.


    -- Bill Stewart [Bill_Stewart]

    Wednesday, October 28, 2015 3:05 PM
  • You are really helpful guys

    The opinion expressed by me is not an official position of Microsoft

    Wednesday, October 28, 2015 3:18 PM
  • Have anyone other ideas desides search the Internet and do not ask questions on the forum?

    If you dont have any concretic propositions please dont write anything


    The opinion expressed by me is not an official position of Microsoft


    • Edited by Vector BCO Thursday, October 29, 2015 12:24 PM
    Thursday, October 29, 2015 12:23 PM
  • If you dont have any concretic propositions please dont write anything

    There is no requirement that someone from this forum will be able to reproduce your environment, debug code, and solve the problem. People answering questions in this forum are volunteers, and there is no SLA.

    If this is critical to your business, you will need to hire someone to help you or open a case with Microsoft support.


    -- Bill Stewart [Bill_Stewart]

    Thursday, October 29, 2015 1:44 PM
  • Dear Bill_Stewart,

    Im answerer on this forum to (you can see my points and answers in my profile), I know forum rules, and I know about Microsoft support.

    I only try to find information about my case. This script interesting not for me only

    In this topic Slava Fedenko want to get script, and in few topics its actual too

    I have found other information about my script, but it still not work properly

    $wsus = Get-WSUSServer -Name wsus -PortNumber 80
    $wsus |  Get-Member -Name GetDatabaseConfiguration
    $db = $wsus.GetDatabaseConfiguration().CreateConnection()
    $db.connect()
    $db
    $result = $db.GetDataSet('select * from INFORMATION_SCHEMA.TABLES',[System.Data.CommandType]::Text)
    $result.tables
    
    I think that in one of this table contains information about location files on my WSUS server, but dont know in what exactly, and how i can get it


    The opinion expressed by me is not an official position of Microsoft

    Thursday, October 29, 2015 2:32 PM
  • I think that in one of this table contains information about location files on my WSUS server, but dont know in what exactly, and how i can get it

    So then, your question is really about details of the WSUS database, rather than scripting.

    Please ask your question in the correct forum:

    https://social.technet.microsoft.com/Forums/scriptcenter/en-Us/home?forum=winserverwsus


    -- Bill Stewart [Bill_Stewart]

    Thursday, October 29, 2015 3:55 PM
  • I think my question about scripting using wsus api or other mechanism

    Can you move my question to correct forum?


    The opinion expressed by me is not an official position of Microsoft

    Thursday, October 29, 2015 4:13 PM
  • It's better if you start a new question. Be specific that you are looking for information about the WSUS database. I'd leave scripting out of your question to avoid confusion.

    -- Bill Stewart [Bill_Stewart]

    Thursday, October 29, 2015 4:32 PM
    • Marked as answer by Vector BCO Thursday, November 5, 2015 5:22 AM
    Thursday, November 5, 2015 5:22 AM
  • Thanks Bill for advice

    The opinion expressed by me is not an official position of Microsoft

    Thursday, November 5, 2015 5:23 AM