locked
Powershell RRS feed

  • Question

  • Experts,

       the below script is running fine but I have two issues...

    1. I would like for the output to show the arrival date or date synchronized to my wsus server.

    2. I would like to export the information to a csv file. (when I open the file nothing is there)

    here is the script.....

    [void][reflection.assembly]::LoadWithPartialName("Microsoft.UpdateServices.Administration")
    $wsus = [Microsoft.UpdateServices.Administration.AdminProxy]::GetUpdateServer('myserver',$False,port)
    $updates = $wsus.GetUpdates()
    ForEach ($update in $updates) {
    New-Object PSObject -Property @{
    Id = $update.Id.UpdateId.ToString()
    Title = $update.Title
    Source = $update.UpdateSource.ToString() | Export-Csv -path C:\temp\upate-guid.csv
    }
    }

    Any assistance is appreciated.


    Flite23

    • Edited by Flite23 Friday, May 8, 2015 6:13 PM
    Friday, May 8, 2015 6:08 PM

Answers

  • Learn to format you code so you can see your mistakes.

    [void][reflection.assembly]::LoadWithPartialName("Microsoft.UpdateServices.Administration")
    $wsus = [Microsoft.UpdateServices.Administration.AdminProxy]::GetUpdateServer('myserver',$False,port)
    $wsus.GetUpdates() |
        Select UpdateId,Title,UpdateSource
    
    This is all you need.


    \_(ツ)_/

    • Marked as answer by Flite23 Monday, May 11, 2015 12:29 PM
    Friday, May 8, 2015 7:30 PM

All replies

  • Do you understand anything about what the code is doing?


    -- Bill Stewart [Bill_Stewart]

    Friday, May 8, 2015 6:23 PM
  • Learn to format you code so you can see your mistakes.

    [void][reflection.assembly]::LoadWithPartialName("Microsoft.UpdateServices.Administration")
    $wsus = [Microsoft.UpdateServices.Administration.AdminProxy]::GetUpdateServer('myserver',$False,port)
    $wsus.GetUpdates() |
        Select UpdateId,Title,UpdateSource
    
    This is all you need.


    \_(ツ)_/

    • Marked as answer by Flite23 Monday, May 11, 2015 12:29 PM
    Friday, May 8, 2015 7:30 PM
  • Thanks for the assistance. This worked fine. Flite23

    • Edited by Flite23 Monday, May 11, 2015 12:30 PM
    Monday, May 11, 2015 12:30 PM