Powershell function for showing some system information
This is a function I created just because I wanted to toy around with Powershell and get-wmiobject. Also, this is my first function where I made it possible to use a switch parameter. What the function does is gather some system information using get-wmiobject. The info is written to a temp file and then shown using out-gridview. If the KeepTempFile parameter is used the temp file is saved in the users profile, if not it is deleted after the function finishes. Heres the code: function Show-Debug { Param( [switch]$KeepTempFile ) $tempfile = “$env:userprofilepstempfile.txt” New-Item $tempfile -ItemType file -Force Get-WmiObject -Class Win32_ComputerSystem |fl Manufacturer,Model,Name,Domain,PrimaryOwnerName | Out-File $tempfile -Append Get-WmiObject -class “Win32_BIOS” -namespace “rootCIMV2″ -computername localhost | fl BIOSVersion,Serialnumber,Status | Out-File $tempfile -Append Get-WmiObject Win32_OperatingSystem | fl @{Expression={$_.Caption};Label=”OS Name”},SerialNumber,OSArchitecture,Version | Out-File $tempfile -Append Get-WmiObject Win32_PhysicalMemory | ft Tag,Capacity,Speed | Out-File $tempfile -Append Get-WmiObject Win32_Processor | fl DeviceID,Manufacturer,Caption,Name,NumberOfCores,NumberOfLogicalProcessors,MaxClockSpeed,CurrentClockSpeed,L2CacheSize,L3CacheSize,Status | Out-File $tempfile -Append Get-Content…