This can be a fast, easy submit. The requirement is straightforward. Get a report from all of the computer systems within the community reporting the final Home windows replace date, Home windows replace put in KB, and the Home windows uptime.

The script will get the content material from a file containing all the pc names as an array and saves the outcome on the person’s desired vacation spot.

To make use of the script, use the next format.

MyScript.ps1 -FilePath C:MyComputerlist.txt -SaveTo C:SaveResult.csv

The result’s a CSV file that

result

Right here is the script. Be happy to make use of it, and let me know if you happen to advocate any updates.

Param
    (
        # File Path 
        [Parameter(Mandatory=$true)]
        $FilePath,
        [parameter(mandatory=$true)]
        $SaveTo
    )
 
$Computer systems = Get-Content material -Path $FilePath

$End result=@()

Foreach ($Laptop in $Computer systems) {

    $ResultObject=[PSCustomObject]@{
        'Server Title'=''
        'Uptime'=''
        'Days Since Final Patch'=''
        'Final Replace KB'=''
        'Final Patch Date & Time'=''
    }

    Strive Choose-Object -First 1
        $ResultObject.'Final Patch Date & Time' = ($lastPatch.InstalledOn).Date.ToString("dd/MM/yyy")
        $ResultObject.'Final Replace KB'=$lastPatch.HotFixID

        # Get Days Since Final Patch

        Write-host "Processing Final Days between patch for $($laptop)"
        $Dateforpatch=(Get-Date) - $lastPatch.InstalledOn
        $ResultObject.'Days Since Final Patch' =($dateforpatch).Days
        $End result+=$ResultObject

        

            Catch{
                Write-Host "Ops, Error for $($laptop)"
                $End result+=$ResultObject
                $Error[0]

            }

}
$outcome
$outcome | Export-Csv $SaveTo -NoTypeInformation

I hope this script helps. There will likely be extra scripts like that. Let me know in case you have any concepts within the remark part beneath.

That’s it for immediately; check out the next submit. You’ll like it.

PowerShell Module to get RDP Session Information