MiTo
October 3, 2020, 1:17pm
1
Hi,
i add a little bit of logging to the AppDeployToolkitMain.ps1 (PSADT 3.8.3) around line 11387
To get more information about the client when analys the log file… May be can be added in the next version.
Last Reboot
[string]$CleanDate = $null
$LastBootUpTime = (Get-WmiObject -Class ‘Win32_OperatingSystem’ -ErrorAction ‘SilentlyContinue’).LastBootUpTime
$CleanDate = [Management.ManagementDateTimeConverter]::ToDateTime($LastBootUpTime)
Diskspace
[string]$Space = $null
$Result = Get-WmiObject win32_logicaldisk -Filter “Drivetype=3” | Select-Object -Property DeviceID,FreeSpace -ErrorAction ‘SilentlyContinue’
foreach ($Drive in $Result) {
If ($Drive.DeviceID -imatch “C:”) {
$Space = [math]::Round($Drive.FreeSpace / 1MB)
}
}
Write-Log -Message “Last Reboot [$CleanDate]” -Source $appDeployToolkitName
Write-Log -Message “Free Diskspace on Drive [C:] - [$Space MB]” -Source $appDeployToolkitName
Best regards
M
You shouldn’t assume there is a C: drive.
2 Likes
MiTo
October 5, 2020, 12:17pm
3
Youre right, replace “C:” with $envSystemdrive
1 Like
MiTo
August 21, 2024, 9:09am
4
Long Time ago…
Every Build i have to add somethink for logging.
## Last Reboot
[string]$CleanDate = $null
$LastBootUpTime = (Get-WmiObject -Class 'Win32_OperatingSystem' -ErrorAction 'SilentlyContinue').LastBootUpTime
$CleanDate = [Management.ManagementDateTimeConverter]::ToDateTime($LastBootUpTime)
## Free Diskspace on Systemdrive
[string]$Space = $null
$Result = Get-WmiObject win32_logicaldisk -Filter "Drivetype=3" | Select-Object -Property DeviceID,FreeSpace -ErrorAction 'SilentlyContinue'
foreach ($Drive in $Result) {
If ($Drive.DeviceID -imatch "$envSystemDrive") {
$Space = [math]::Round($Drive.FreeSpace / 1MB)
}
}
## Physical RAM
[Int]$PhysicalRAM = $null
$PhysicalRAM = (Get-WMIObject -Class Win32_PhysicalMemory -ErrorAction 'SilentlyContinue' | Measure-Object -Property Capacity -Sum -ErrorAction 'SilentlyContinue' | % { [Math]::Round(($_.Sum / 1GB), 2) })
Write-Log -Message "Last Reboot was on [$CleanDate]" -Source $appDeployToolkitName
Write-Log -Message "Free Diskspace on Drive [$envSystemDrive\] is [$Space MB]" -Source $appDeployToolkitName
Write-Log -Message "Physical Memory is [$PhysicalRAM GB]" -Source $appDeployToolkitName