Skip to content

Instantly share code, notes, and snippets.

@LudovicOmarini
Last active August 10, 2021 14:21
Show Gist options
  • Save LudovicOmarini/c7ec718f05b2cd31f79ebb6f5d0e6f85 to your computer and use it in GitHub Desktop.
Save LudovicOmarini/c7ec718f05b2cd31f79ebb6f5d0e6f85 to your computer and use it in GitHub Desktop.
Get informations about computer(s) remotely.
<#
.SYNOPSIS
Get informations about computer(s) remotely.
.DESCRIPTION
This script give you informations about one or multiple computers.
You can retrieve the serial number, the manufacturer, the model, the os, the architecture and the users currently connected.
.EXAMPLE
Get informations of a computer
.\Get-Informations-Of-Remote-Computers.ps1 -Computers DESKTOP-0123
Get informations of multiple computers
.\Get-Informations-Of-Remote-Computers.ps1 -Computers DESKTOP-0123, PRODUCTIONPC, DESKTOP0505
#>
Param(
[Parameter(Mandatory=$true)][string]$Computers=$(throw "You haven't set a computer(s) name.")
)
$ComputersList = $Computers -split ','
foreach ($Computer in $ComputersList){
$SerialNumber = (Get-WmiObject -computer $Computer -cl win32_BIOS).SerialNumber
$Manufacturer = (Get-WmiObject -computer $Computer -cl win32_ComputerSystem).Manufacturer
$Model = (Get-WmiObject -computer $Computer -cl win32_ComputerSystem).Model
$Os = (Get-WMIObject -computer $Computer win32_operatingsystem ).name
$Architecture = (Get-WmiObject -computer $Computer Win32_OperatingSystem).OSArchitecture
$UserConnected = (Get-WmiObject -computer $Computer -cl win32_ComputerSystem).Username
Write-Host "--"
Write-Host "Computer :" $Computer
Write-Host "Serial Number :" $SerialNumber
Write-Host "Manufacturer :" $Manufacturer
Write-Host "Model :" $Model
Write-Host "OS :" $Os
Write-Host "Architecture :" $Architecture
Write-Host "User connected :" $UserConnected
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment