forked from jajp777/powershell-scripts-1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
AssetManagementReport.ps1
19 lines (19 loc) · 1.07 KB
/
AssetManagementReport.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
[CmdletBinding()]
param () #param
process {
$IfIndex = (Get-CimInstance -ClassName Win32_IP4RouteTable -Filter "Destination='0.0.0.0'").InterfaceIndex[0]
$IpAddress = (Get-CimInstance -ClassName Win32_NetworkAdapterConfiguration -Filter "InterfaceIndex=$IfIndex").IPAddress[0]
$WmiComputerSystemProduct = Get-CimInstance -ClassName Win32_ComputerSystemProduct
$SerialNumber = $WmiComputerSystemProduct.IdentifyingNumber.Trim()
$Vendor = $WmiComputerSystemProduct.Vendor.Split(' ')[0].Trim().Trim(',')
$Model = $WmiComputerSystemProduct.Name.Trim()
$MacAddress = (Get-CimInstance -ClassName Win32_NetworkAdapter | Where-Object { $_.InterfaceIndex -eq $IfIndex }).MACAddress
New-Object -TypeName psobject -Property @{
ComputerName = [string] $env:COMPUTERNAME
IpAddress = [string] $IpAddress
MacAddress = [string] $MacAddress
SerialNumber = [string] $SerialNumber
Vendor = [string] $Vendor
Model = [string] $Model
} | Select-Object -Property ComputerName,IpAddress,MacAddress,SerialNumber,Vendor,Model
} #process