none
Get-Hotfix using Read host for $Computername and $ID RRS feed

  • Question

  • I'm trying to insert Multiple KBS when prompted and have something incorrect. I have tried Separating with commas, with spaces, with and without single or double quotes.

    <# Prompt for PC Name and ID KB2577917,KB958830,KB3191566#>
    
    $computername = Read-Host "PC Name"
    $ID = Read-Host "Enter ID(s)"
    Get-HotFix -ComputerName $computername -Id $ID


    Tuesday, May 8, 2018 11:51 AM

Answers

  • "-ID" requires an array and not a string of KBs. 

    $ID = (Read-Host 'Enter ID(s) separated by commas') -split ','


    \_(ツ)_/

    Tuesday, May 8, 2018 12:02 PM

All replies

  • "-ID" requires an array and not a string of KBs. 

    $ID = (Read-Host 'Enter ID(s) separated by commas') -split ','


    \_(ツ)_/

    Tuesday, May 8, 2018 12:02 PM
  • Thank you I'm testing now. I used 'KB2577917,KB958830,KB3191566' when prompted for ID and the search result came back listing only the Middle option and as I was typing this I used KB2577917,KB958830,KB3191566 when prompted and the results came back as if I ran it with -ID 'KB2577917,KB958830,KB3191566'.

    Thank You Very Much!

    RESULTS:

    $computername = Read-Host "PC Name"
    $ID = (Read-Host 'Enter ID(s) separated by commas') -split ','
    Get-HotFix -ComputerName $computername -Id $ID
    PC Name: NCSP-WKS185SPHC
    Enter ID(s) separated by commas: KB2577917,KB958830,KB3191566
    Source        Description      HotFixID                 InstalledBy                               InstalledOn             
          ------        -----------      --------                  -----------                       -----------             
    PC_XXXX          Update          KB958830      NT AUTHORITY\SYSTEM     3/9/2018 12:00:00 AM    
    PC_XXXX          Update          KB3191566     NT AUTHORITY\SYSTEM    3/9/2018 12:00:00 AM    
    PC_XXXX          Hotfix           KB2577917    Domain\adminacct             5/7/2018 12:00:00 AM    

    Tuesday, May 8, 2018 12:31 PM