Skip to content

Commit 211628c

Browse files
committed
Fix for issue EventSource AdvancedOptimizations missing if older VDOT was previously run #185
1 parent a56a669 commit 211628c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Windows_VDOT.ps1

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,15 +122,19 @@ BEGIN
122122
{
123123
New-ItemProperty -Path $KeyPath -Name $LastRun -Value $LastRunValue | Out-Null
124124
}
125-
125+
126+
$EventSources = @('VDOT', 'WindowsMediaPlayer', 'AppxPackages', 'ScheduledTasks', 'DefaultUserSettings', 'Autologgers', 'Services', 'NetworkOptimizations', 'LGPO', 'AdvancedOptimizations', 'DiskCleanup')
126127
If (-not([System.Diagnostics.EventLog]::SourceExists("Virtual Desktop Optimization")))
127128
{
128129
# All VDOT main function Event ID's [1-9]
129-
$EventSources = @('VDOT', 'WindowsMediaPlayer', 'AppxPackages', 'ScheduledTasks', 'DefaultUserSettings', 'Autologgers', 'Services', 'NetworkOptimizations', 'LGPO', 'AdvancedOptimizations', 'DiskCleanup')
130130
New-EventLog -Source $EventSources -LogName 'Virtual Desktop Optimization'
131131
Limit-EventLog -OverflowAction OverWriteAsNeeded -MaximumSize 64KB -LogName 'Virtual Desktop Optimization'
132132
Write-EventLog -LogName 'Virtual Desktop Optimization' -Source 'VDOT' -EntryType Information -EventId 1 -Message "Log Created"
133133
}
134+
Else
135+
{
136+
New-EventLog -Source $EventSources -LogName 'Virtual Desktop Optimization' -ErrorAction SilentlyContinue
137+
}
134138
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)"
135139

136140
$StartTime = Get-Date

0 commit comments

Comments
 (0)