Skip to content

Commit

Permalink
Fix for issue EventSource AdvancedOptimizations missing if older VDOT…
Browse files Browse the repository at this point in the history
… was previously run #185
  • Loading branch information
tmmuessig committed Jan 22, 2024
1 parent a56a669 commit 211628c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Windows_VDOT.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,19 @@ BEGIN
{
New-ItemProperty -Path $KeyPath -Name $LastRun -Value $LastRunValue | Out-Null
}


$EventSources = @('VDOT', 'WindowsMediaPlayer', 'AppxPackages', 'ScheduledTasks', 'DefaultUserSettings', 'Autologgers', 'Services', 'NetworkOptimizations', 'LGPO', 'AdvancedOptimizations', 'DiskCleanup')
If (-not([System.Diagnostics.EventLog]::SourceExists("Virtual Desktop Optimization")))
{
# All VDOT main function Event ID's [1-9]
$EventSources = @('VDOT', 'WindowsMediaPlayer', 'AppxPackages', 'ScheduledTasks', 'DefaultUserSettings', 'Autologgers', 'Services', 'NetworkOptimizations', 'LGPO', 'AdvancedOptimizations', 'DiskCleanup')
New-EventLog -Source $EventSources -LogName 'Virtual Desktop Optimization'
Limit-EventLog -OverflowAction OverWriteAsNeeded -MaximumSize 64KB -LogName 'Virtual Desktop Optimization'
Write-EventLog -LogName 'Virtual Desktop Optimization' -Source 'VDOT' -EntryType Information -EventId 1 -Message "Log Created"
}
Else
{
New-EventLog -Source $EventSources -LogName 'Virtual Desktop Optimization' -ErrorAction SilentlyContinue
}
Write-EventLog -LogName 'Virtual Desktop Optimization' -Source 'VDOT' -EntryType Information -EventId 1 -Message "Starting VDOT by user '$env:USERNAME', for VDOT build '$WindowsVersion', with the following options:`n$($PSBoundParameters | Out-String)"

$StartTime = Get-Date
Expand Down

0 comments on commit 211628c

Please sign in to comment.