Patch Details

Tagged: ,

This topic contains 2 replies, has 3 voices, and was last updated by Profile photo of Vincent Karunaidas Vincent Karunaidas 1 year, 6 months ago.

  • Author
  • #34007
    Profile photo of Partho Sankar Roy
    Partho Sankar Roy

    Hi Guys,

    I am trying to create a function which will check for a specific KB on a list of servers and generate the report, I am all done so far, however can someone help me on a validation for checking the servers status, What I am looking for is if the server is online then only the script would run else the it will write an error in the report file. I have tried using test-connection but dunno about array and collection as I am not from a developing back ground.

    Below is what I have wrote so far.

    function Get-PatchDetails



    Param (


    $Computers=Get-Content -Path $path

    foreach ($c in $Computers)


    if (Get-HotFix -Id $id -ComputerName $c )

    {Add-Content "$c have the patch $id" -Path $reportfile}


    {(Add-Content "$c doesnt have the patch $id" -Path $reportfile)}


  • #34023
    Profile photo of ertuu85

    Hey, you can use something like this..kind of a skeleton one I use for testing connection/bad access/cant ping's.

    You'll have to add whatever report building you'd like in each section

    $svrlist = get-content serverlist.txt
    foreach ($svr in $svrlist) {
    	if ((test-connection -computername $svr -count 1).StatusCode -eq 0) {
    			#works if in here       
            		#Can't Access"
    		#Can't Ping"
  • #34035
    Profile photo of Vincent Karunaidas
    Vincent Karunaidas

    Get-PatchDetails Function

You must be logged in to reply to this topic.