function get-resources {

    param ( $pc )

    $sBlock = {
        Write-Progress -Activity "Getting resource data for $pc" -Status "Getting disk data" -PercentComplete 10 -ParentId 1
        try {$win32_LogicalDisk = Get-CimInstance -ClassName Win32_LogicalDisk -Filter "DriveType=3" } catch {$win32_LogicalDisk = $null} #| Diskspace
        $obj = New-Object -TypeName PSObject

        # Get system information
        Write-Progress -Activity "Getting resource data for $pc" -Status "Getting OS data" -PercentComplete 16 -ParentId 1
        $sysInfo = Get-WmiObject -Class Win32_OperatingSystem
        Write-Progress -Activity "Getting resource data for $pc" -Status "Getting processor data" -PercentComplete 33 -ParentId 1
        $sysProc = Get-WmiObject -Class Win32_Processor
        Write-Progress -Activity "Getting resource data for $pc" -Status "Getting memory data" -PercentComplete 50 -ParentId 1
        $sysMem = Get-WmiObject -Class Win32_PhysicalMemory

        $sysOS = $sysInfo.Caption
        $sysVersion = $sysInfo.Version
        if ($sysMem.Length) {
            $sysTotalMem = 0
            foreach ($mem in $sysMem) {
                $sysTotalMem += $mem.Capacity
            }
            $sysTotalMem /= 1GB
        } else {
            $sysTotalMem = $sysMem.Capacity / 1GB
        }

        Write-Progress -Activity "Getting resource data for $pc" -Status "Getting processor usage" -PercentComplete 66 -ParentId 1
        # Get processor usage
        $procUsage = [math]::Round((Get-Counter '\Processor(_Total)\% Processor Time').CounterSamples.CookedValue)

        Write-Progress -Activity "Getting resource data for $pc" -Status "Getting memory usage" -PercentComplete 83 -ParentId 1
        # Get memory usage
        $memUsage = [Math]::Round((1 - (Get-Counter '\Memory\Available MBytes').CounterSamples.CookedValue/($sysTotalMem*1GB/1MB))*100,1)

        Write-Progress -Activity "Getting resource data for $pc" -Status "Getting network adapter data" -PercentComplete 100 -ParentId 1
        # Get Physical Network Adapter information
        $netAdapters = Get-NetAdapter -physical | Where-Object status -eq 'up'

        #Free Harddrive Space
        $CompFreeSpace = @([math]::Round($win32_LogicalDisk.FreeSpace / 1gb,2),[math]::Round($win32_LogicalDisk.Size / 1gb,2))
        $freeDisk = $compFreeSpace[0]
        $maxDisk = $compfreeSpace[1]

        $obj | Add-Member -MemberType NoteProperty -Name 'OS' -Value $sysOS
        $obj | Add-Member -MemberType NoteProperty -Name 'Version' -Value $sysVersion
        $obj | Add-Member -MemberType NoteProperty -Name 'TotalMem' -Value $sysTotalMem
        $obj | Add-Member -MemberType NoteProperty -Name 'MemUsage' -Value $memUsage
        $obj | Add-Member -MemberType NoteProperty -Name 'Processor' -Value $($sysProc.Name) 
        $obj | Add-Member -MemberType NoteProperty -Name 'NumberOfCores' -Value $($sysProc.NumberOfCores)
        $obj | Add-Member -MemberType NoteProperty -Name 'ProcUsage' -Value $procUsage
        $obj | Add-Member -MemberType NoteProperty -Name 'NetAdapters' -Value $netAdapters
        $obj | Add-Member -MemberType NoteProperty -Name 'freeDisk' -Value $freeDisk
        $obj | Add-Member -MemberType NoteProperty -Name 'maxDisk' -Value $maxDisk

        Write-Progress -Activity "Getting resource data for $pc" -Completed
        return $obj
    }
    $output = @()
    $output += Invoke-Command -ScriptBlock $sblock -ComputerName $pc -SessionOption (New-PSSessionOption -NoMachineProfile -OpenTimeout 45000) | Select-Object * -ExcludeProperty RunspaceId, PSComputerName, PSShowComputerName

    # Display system information
    Write-Output "System Information:"
    Write-Output "-------------------"
    Write-Output "Computer Name: $pc"
    Write-Output "Operating System: $($output.OS)"
    Write-Output "Version: $($output.Version)"
    Write-Output "Total Physical Memory: $($output.TotalMem) GB, Memory Usage: $($output.memUsage) %"
    Write-Output "Processor: $($output.Name) $($output.NumberOfCores) cores, Processor Usage: $($output.procUsage)%"
    Write-Output "Free Disk Space: $($output.freeDisk) GB / $($output.maxDisk)  GB"
    Write-Output "-------------------"
    Write-Output "Physical Network Adapters:"
    foreach ($netAdapter in $output.netAdapters) {
        $speed = $netAdapter.Speed
        if ($speed -gt 1000000000) {
            $speed = "{0} Gbps" -f ($speed/1000000000)
        } elseif($speed -gt 1000000){
            $speed = "{0} Mbps" -f ($speed/1000000)
        }
        Write-Output "$($netAdapter.InterfaceDescription)`r`n`tType: $($netAdapter.name)`r`n`tLink Speed: $speed"
    }
}