So I am creating a basic HTML report for a System Server Audit, some extracts which are relevant:
$system = Get-WmiObject -ComputerName $cmpSys Win32_ComputerSystem
$body = $null
$body += @"
<font color="red">Hostname: </font>$cmpSys
<br>
<font color="red">Domain: </font>($system.Domain)
<br>
"@
Now, Hostname: $cmpSys - correctly produces Hostname in red and the hostname in black
However, I am calling $system.Domain in the format later on, which produces in my report:
Domain: (\\W7WKS01\root\cimv2:Win32_ComputerSystem.Name="W7WKS01".Domain)
But it should just display W7WKS01
Any ideas?