More Logging in AppDeployToolkitMain.ps1

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.

1 Like

Youre right, replace “C:” with $envSystemdrive

1 Like