snippets/core/PAF_Get-SystemInfo.ps1
<#
.Synopsis This snippet retrieves basic system information such as OS version, computer name, and total RAM. .Description This script demonstrates how to retrieve basic system information using WMI and CIM cmdlets. .LINK https://github.com/voytas75/PowershellFramework The GitHub repository for the PowerShell Awesome Framework. #> function Get-SystemInfo { <# :CATEGORY System Information :NAME Get-SystemInfo #> $osVersion = Get-WmiObject -Class Win32_OperatingSystem | Select-Object -ExpandProperty Caption $computerName = $env:COMPUTERNAME $totalRAM = (Get-CimInstance -ClassName Win32_ComputerSystem | Select-Object -ExpandProperty TotalPhysicalMemory) / 1GB $systemInfo = @{ OSVersion = $osVersion ComputerName = $computerName TotalRAM_GB = $totalRAM } return $systemInfo } Get-SystemInfo |