Functions/PlatformManagement/Get-FpsComputerInfo.ps1
<#
.SYNOPSIS Returns general information about the system. .DESCRIPTION Returns the computer name, domain name, OS, OS Version, PS Version, Memory total and available, CPU name, Total sockets, cores and threads. .EXAMPLE Get-FpsComputerInfo .EXAMPLE Get-FpsComputerInfo -Computer 'MyRemoteComputer' #> function Get-FpsComputerInfo { [CmdletBinding()] param( [string] $Computer = $env:COMPUTERNAME ) [scriptblock] $ScriptBlock = { $OperatingSystem = Get-WmiObject -Class Win32_OperatingSystem $Processor = Get-WmiObject Win32_Processor # Calculate total available CPU Cores $TotalCPUCores = 0 $Processor.NumberOfCores | ForEach-Object {$TotalCPUCores += $_ } # Calculate total available CPU threads $TotalCPUThreads = 0 $Processor.ThreadCount | ForEach-Object {if($_){ $TotalCPUThreads += $_ }} if ($TotalCPUThreads -eq 0){$TotalCPUThreads = $TotalCPUCores} # Create custom PowerShell object with system information $SystemInfo = New-Object psobject -Property ([ordered] @{ 'ComputerName' = hostname 'DomainName' = $env:USERDNSDOMAIN 'OSName' = $OperatingSystem.Caption 'OSVersion' = $OperatingSystem.Version 'PSVersion' = $PSVersionTable.PSVersion.ToString() 'TotalMemoryGB' = [math]::round($OperatingSystem.TotalVisibleMemorySize/1024/1024) 'TotalFreeMemoryGB'= [math]::round(($OperatingSystem.FreePhysicalMemory/1024/1024), 1) 'CPUName' = ($Processor | Select-Object -First 1).Name 'TotalCPUSocket' = ($Processor | Measure-Object).Count 'TotalCPUCores' = $TotalCPUCores 'TotalCPUThreads' = $TotalCPUThreads }) $SystemInfo } $AdditionParams = @{} if ($Computer -ne 'localhost' -and $Computer -ne $env:COMPUTERNAME) { $AdditionParams = @{'ComputerName' = $Computer} } Invoke-Command @AdditionParams -ScriptBlock $ScriptBlock } Export-ModuleMember -Function Get-FpsComputerInfo |