10/03/2022 Update: This works fine, but using the open source Snipe-IT inventory product combined with the Snipe-IT API in PowerShell works even better!

The following script can get inventory info for a local or remote PC. A Dell API Key is required to to get ship date and warranty expiration date info. Replace “Software” with the name of applications you want to check for on PCs. Modify as needed for your environment.

$Log = "$results.txt"
$HostListFile = "hosts.txt"
Remove-Item -Force $Log -ErrorAction Ignore
Remove-Variable Hostname -ErrorAction Ignore
Remove-Variable Target -ErrorAction Ignore
Remove-Variable pcinfo -ErrorAction Ignore

$Hostname = $args[0]
if (!$Hostname) {
	$Hostname = Read-Host -Prompt "Enter Hostname [$Hostname] "
}
if (!$Hostname) {
	$Target = "self"
	$Hostname = $env:computername
}
if ($Hostname -eq "file"){
	[string[]]$Hostname = Get-Content -Path $HostListFile
	$Target = "file"
}
if ($Target -ne "file") {
	$Hostname = $Hostname.Split(",")
}

function SuperPing($Hostname) {
	Remove-Variable reply -ErrorAction Ignore 
	[int]$timeout = 20
	[switch]$resolve = $true
	[int]$TTL = 128
	[switch]$DontFragment = $false
	[int]$buffersize = 32
	$options = new-object system.net.networkinformation.pingoptions
	$options.TTL = $TTL
	$options.DontFragment = $DontFragment
	$buffer=([system.text.encoding]::ASCII).getbytes("a"*$buffersize)	
	$ping = new-object system.net.networkinformation.ping
	$reply = $ping.Send($Hostname,$timeout,$buffer,$options)
		if ($reply.Status -eq "Success"){
			return "True"
		}
		else {
			return "False"
		}
}
function Get-Inventory() {
	function Get-Mac () {
		$network = (Get-WmiObject win32_networkadapterconfiguration | where{$_.DHCPEnabled -eq "True"} | where{$_.MacAddress -notlike ""} | where{$_.Description -notlike "*Virtual*"} | where{$_.Description -notlike "*Bluetooth*"})
		$mac = ""
		foreach ($mac_item in $network) {
			$mac += $mac_item.MacAddress
		}
		return $mac
	}
	function Get-Encryption() {
		$bitlocker = Get-BitlockerVolume -MountPoint C
		if ($bitlocker.ProtectionStatus -eq 'off') {
			return "No"
		} else {
			return "Yes"
		}
	}
	function Get-Installed($program) {
	$sw1 = gp HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*
	$sw2 = gp HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*
		if ((($sw1).DisplayName -Match $program).Length -gt 0 -eq "True" -Or `
			(($sw2).DisplayName -Match $program).Length -gt 0 -eq "True") {
			return "Yes"
		}
		else {
			return "No"
		}

	}
	function Get-Type($model) {
		if ($model -Like "*XPS 15*" -Or $model -Like "*XPS 13*" -Or $model -Like "*Latitude*"){
			return "Laptop"
		}
		elseif ($model -Like "*Optiplex*") {
			return "Desktop"
		}
		else {
			return "Unknown"
		}
	}
	function Get-Dell([string]$ServiceTag) {
	$ApiKey="REPLACE_WITH_DELL_API_KEY"
	$KeySecret="REPLACE_WITH_DELL_KEY_SECRET"
		if (!$token) {
			$AuthURI = "https://apigtwb2c.us.dell.com/auth/oauth/v2/token"
			$OAuth = "$ApiKey`:$KeySecret"
			$Bytes = [System.Text.Encoding]::ASCII.GetBytes($OAuth)
			$EncodedOAuth = [Convert]::ToBase64String($Bytes)
			$Headers = @{ }
			$Headers.Add("authorization", "Basic $EncodedOAuth")
			$Authbody = 'grant_type=client_credentials'
			[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
			$AuthResult = Invoke-RESTMethod -Method Post -Uri $AuthURI -Body $AuthBody -Headers $Headers
			$token = $AuthResult.access_token
			$headers = @{"Accept" = "application/json" }
			$headers.Add("Authorization", "Bearer $token")
		}
	$params = @{ }
	$params = @{servicetags = $ServiceTag; Method = "GET" }
	$response = Invoke-RestMethod -Uri "https://apigtwb2c.us.dell.com/PROD/sbil/eapi/v5/asset-entitlements" -Headers $headers -Body $params -Method Get -ContentType "application/json" -ea 0
	$Json = $response | ConvertTo-Json
	$response = $Json | ConvertFrom-Json 
	$Device = $response.productLineDescription
	$ShipDate = $response.shipDate
	$EndDate = ($response.entitlements | Select -Last 1).endDate
	$ShipDate = $ShipDate | Get-Date -f "MM-dd-y"
	$EndDate = $EndDate | Get-Date -f "MM-dd-y"
	$type = $response.ProductID
	if ($type -Like '*desktop*') { 
		$type = 'desktop'        
	}
	elseif ($type -Like '*laptop*') { 
		$type = 'laptop'
	}
	return $ShipDate, $EndDate, $type
	}

	$pcinfo = New-Object -TypeName psobject
	$system_info = Get-CimInstance -ClassName Win32_ComputerSystem
	$serial = (gwmi win32_bios).SerialNumber
	$model = $system_info.Manufacturer + " " + $system_info.Model
	$mac = Get-Mac
	$encryption = Get-Encryption
	$software1 = Get-Installed("Software1")
	$Software2 = Get-Installed("software2")
	if ($model -like "*Dell*"){
		$dell = Get-Dell($serial)
	}
	if (!$dell[2]) {
		$type = Get-Type($model)
	}
	else {
		$type = $dell[2]
	}

	$pcinfo | Add-Member -NotePropertyName Name -NotePropertyValue $system_info.Name
	$pcinfo | Add-Member -NotePropertyName Domain -NotePropertyValue $system_info.Domain
	$pcinfo | Add-Member -NotePropertyName Serial -NotePropertyValue $serial
	$pcinfo | Add-Member -NotePropertyName OS -NotePropertyValue (Get-WmiObject -Class Win32_OperatingSystem).Caption
	$pcinfo | Add-Member -NotePropertyName Model -NotePropertyValue $model
	$pcinfo | Add-Member -NotePropertyName Memory -NotePropertyValue ([string]($system_info.TotalPhysicalMemory/1GB -as [int]) + "GB")
	$pcinfo | Add-Member -NotePropertyName Mac -NotePropertyValue $mac
	$pcinfo | Add-Member -NotePropertyName Encryption -NotePropertyValue $encryption
	$pcinfo | Add-Member -NotePropertyName Type -NotePropertyValue $type
	$pcinfo | Add-Member -NotePropertyName Software1 -NotePropertyValue $software1
	$pcinfo | Add-Member -NotePropertyName Software2 -NotePropertyValue $software2
	$pcinfo | Add-Member -NotePropertyName "Ship Date" -NotePropertyValue $dell[0]
	$pcinfo | Add-Member -NotePropertyName "Exp. Date" -NotePropertyValue $dell[1]

	return $pcinfo
}
function Get-Output($pcinfo) {
	$pcinfo `
	| Select-Object Name, Domain, Serial, OS, Model, Memory, Mac, Encryption, `
	Type, Software1, Software2, "Ship Date", "Exp. Date" `
	| Format-List | Out-String | Write-Host
	echo $null | clip.exe
	Remove-Variable clippy -ErrorAction Ignore
	$tab = [char]9
	$clippy = `
	$pcinfo.Name+$tab+`
	$pcinfo.Model+$tab+`
	$pcinfo.Serial+$tab+`
	$pcinfo.Type+$tab+`
	$pcinfo.Memory+$tab+`
	$pcinfo.Mac+$tab+`
	$pcinfo.OS+$tab+`
	$pcinfo.Software1+$tab+`
	$pcinfo.Software2+$tab+`
	$pcinfo.Domain+$tab+`
	$pcinfo.Encryption+$tab+`
	$pcinfo.'Ship Date'+$tab+`
	$pcinfo.'Exp. Date'+$tab
	Set-Clipboard $clippy
	Write-Output $clippy >> $Log
}
if ($Target -eq "self") {
	$pcinfo = Get-Inventory
	Get-Output($pcinfo)
}
else {
	foreach ($thing in $Hostname) {
		$online = SuperPing($thing)
		if ($online -eq "False") {
			Write-Host "$thing is unreachable"
			Write-Output "$thing is unreachable" >> $Log
		}
		else {
			Remove-Variable pcinfo -ErrorAction Ignore
			$pcinfo = Invoke-Command -ComputerName $thing -ScriptBlock ${Function:Get-Inventory}
			Get-Output($pcinfo)
		}
	}
}