Substrings - get domain name from FQDN
This demonstrates how to grab the domain name from an FQDN and add it as a column in a spreadsheet so you can filter on it. CLS [int]$count="" $a=get-scomclass -name "SCOM.Class.URWindowsComputer" | get-scomclassinstance | sort displayname foreach ($i in $a) { $server=$i.path $version=$i."[SCOM.Class.URWindowsComputer].AgentVersion".value $product=$i."[SCOM.Class.URWindowsComputer].Product".value if ($product = "Microsoft Monitoring Agent") { if ($version -ne "2016 UR10" -and $version -ne "n/a") { [int]$count+=1 $start=$server.indexof('.')+1 <- clever bit $domain=$server.Substring($start) <- clever bit "$server^$domain^$product^$version" }}} write-host "Records: $count"