@@ -18,7 +18,7 @@ $MasterScriptVersion Set this location so that script can auto update on all ser
18
18
# $ErrorActionPreference = "SilentlyContinue" #Some non fatal errors may occur uncomment this line if you don't want to display them.
19
19
# #####Variables to fill
20
20
$MasterScriptVersion = " \\Server\share\ServerInventory.ps1"
21
- $logo = " logo .png"
21
+ $logo = " Logo .png"
22
22
$filepath = " \\someserver\someshare"
23
23
$resourcedir = " ./Resources"
24
24
$enableschedtask = $true
@@ -28,6 +28,7 @@ $Scriptdir = "C:\ServerInventory\"
28
28
$sendemail = $false
29
29
30
30
31
+
31
32
# ######
32
33
# # Email Setting if you would like to email the Results
33
34
# ##Edit as appropriate
@@ -92,12 +93,25 @@ $osinfo = Get-WmiObject Win32_OperatingSystem -ComputerName $name | Select Capt
92
93
$osinfo.InstallDate = [management.managementDateTimeConverter ]::ToDateTime($osinfo.InstallDate )
93
94
$osinfo | ConvertTo-html - Body " <H2> Operating System Information </H2>" >> " $filepath \$name .html"
94
95
96
+ # ##Uptime and Last BootVolume
97
+ $wmiPerfOsSystem = Get-WmiObject - computer $name - class Win32_PerfFormattedData_PerfOS_System
98
+ $wmiOS = Get-WmiObject - computer $name - class Win32_OperatingSystem
99
+ $lastBoot = $wmiOS.ConvertToDateTime ($wmiOS.LastBootUpTime )
100
+ New-TimeSpan - seconds $wmiPerfOsSystem.SystemUpTime - ErrorAction SilentlyContinue | select days, hours, minutes, seconds | ConvertTo-html - body " <H2>Uptime</H2>" >> " $filepath \$name .html"
101
+ $lastBoot | select DateTime | ConvertTo-html - body " <H2>Last Boot Time</H2>" >> " $filepath \$name .html"
102
+
103
+
95
104
# ##Windows Updates last installed###
96
105
$Updates = Get-ItemProperty - Path " Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\Results\Install" | select LastSuccessTime
97
106
$Updates.LastSuccessTime = [DATETIME ]::Parse($Updates.LastSuccessTime )
98
107
$updatesout = New-Object - TypeName PSOBject
99
108
$Updates | ConvertTo-Html - body " <H2>Windows Updates Last Installed</H2>" >> " $filepath \$name .html"
100
109
110
+ # ##Event log
111
+ Get-EventLog - LogName System - Newest 30 - EntryType Error, warning | select TimeGenerated, entrytype, source, message | ConvertTo-html - body " <H2>System Events</H2>" >> " $filepath \$name .html"
112
+ Get-EventLog - LogName Application - Newest 30 - EntryType Error, warning | select TimeGenerated, entrytype, source, message | ConvertTo-html - body " <H2>Application Events</H2>" >> " $filepath \$name .html"
113
+
114
+
101
115
# #Time Zone##
102
116
Get-WmiObject win32_TimeZone - ComputerName $name | Select caption | ConvertTo-html - Body " <H2> Time Zone </H2>" >> " $filepath \$name .html"
103
117
0 commit comments