Skip to content

Commit 75ea47e

Browse files
committed
Change to accomodate sending HTML via email
Stops no CSS being applied when sent via email. Now puts CSS inline for when email is enabled.
1 parent 5492271 commit 75ea47e

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

ServerInventory.ps1

+17-10
Original file line numberDiff line numberDiff line change
@@ -51,18 +51,25 @@ $date = Get-Date
5151
$Virtual = (Get-WmiObject win32_systemenclosure -Property Manufacturer)
5252
$CPU = (Get-WmiObject win32_processor -Property Manufacturer)
5353
###Images at top
54-
$a = "<link rel='stylesheet' type='text/css' href='$resourcedir/WEB/theme.css'>"
55-
$a = $a + "<img src ='$resourcedir/WEB/$logo' alt='logo'>"
56-
if ($Virtual.Manufacturer -eq "No Enclosure"){
57-
$a = $a + "<img src ='$resourcdir/WEB/VMWare.png' alt='vmware'>"
58-
}
59-
Elseif ($CPU.Manufacturer -eq "GenuineIntel") {
60-
$a = $a + "<img src='$Resourcedir/WEB/PhysicalIntel.png' alt='intel'>"
54+
if ($sendemail -ne $true){
55+
$a = "<link rel='stylesheet' type='text/css' href='$resourcedir/WEB/theme.css'>"
56+
57+
58+
$a = $a + "<img src ='$resourcedir/WEB/$logo' alt='logo'>"
59+
if ($Virtual.Manufacturer -eq "No Enclosure"){
60+
$a = $a + "<img src ='$resourcdir/WEB/VMWare.png' alt='vmware'>"
61+
}
62+
Elseif ($CPU.Manufacturer -eq "GenuineIntel") {
63+
$a = $a + "<img src='$Resourcedir/WEB/PhysicalIntel.png' alt='intel'>"
64+
}
65+
Else {
66+
$a = $a + "<img src='$resourcedir/WEB/PhysicalAMD.png' alt='AMD'>"
67+
}
6168
}
6269
Else {
63-
$a = $a + "<img src='$resourcedir/WEB/PhysicalAMD.png' alt='AMD'>"
64-
}
65-
70+
$css = Get-Content "$filepath\$resourcedir\WEB\theme.css"
71+
$a = "<style>$css</style>"
72+
}
6673
#### Setting up header and description
6774
ConvertTo-Html -Head $a -Title "Hardware Information for $name" > "$filepath\$name.html"
6875
ConvertTo-Html -Body "<br><br><br><h1>$name</h1>" >> "$filepath\$name.html"

0 commit comments

Comments
 (0)