diff --git a/Windows/Chocolatey/ChocolateyUpgrade.ps1 b/Windows/Chocolatey/ChocolateyUpgrade.ps1
index 7225ffa6d3a7dfc6d2c8b58327a5be136b03e232..a460815a11e5681a2a0fc7d0167a353ba307a49d 100644
--- a/Windows/Chocolatey/ChocolateyUpgrade.ps1
+++ b/Windows/Chocolatey/ChocolateyUpgrade.ps1
@@ -12,10 +12,10 @@ function Remove-OldLogFiles {
    param (
       [string]$logPath,
       [int]$maxFiles,
-      [string]$scriptNameWithoutExtension
+      [string]$scriptName
    )
    # Get all log files for the current script
-   $logFiles = Get-ChildItem -Path $logPath -Filter "$scriptNameWithoutExtension_*.log" | Sort-Object LastWriteTime -Descending
+   $logFiles = Get-ChildItem -Path $logPath -Filter "$scriptName_*.log" | Sort-Object LastWriteTime -Descending
 
    # Check if the number of log files exceeds the maximum allowed
    if ($logFiles.Count -gt $maxFiles) {
@@ -30,6 +30,18 @@ function Remove-OldLogFiles {
 <#== Script starts here ==#>
 Write-Host "Starting script execution..."
 
+<#== Get current date and time ==#>
+Write-Host "Getting current date and time..."
+$currentDateTime = Get-Date -Format "yyyy-MM-dd_HHmm"
+
+# Determine the name of the currently executing script without the extension
+$scriptName = [System.IO.Path]::GetFileNameWithoutExtension($MyInvocation.MyCommand.Name)
+
+<#== Start Transcript ==#>
+Write-Host "Starting transcript..."
+$transcriptPath = "C:\Install Logs\$scriptName`_$currentDateTime.log"
+Start-Transcript -Path $transcriptPath
+
 # Define the busy.flag file path
 $busyFlagPath = "C:\Install Logs\ChocolateyUpgrade_busy.flag"
 
@@ -41,22 +53,9 @@ if (Test-Path $busyFlagPath) {
 
 # Create the busy.flag file and write start time and script information
 $startTime = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
-$scriptName = $MyInvocation.MyCommand.Name
 $busyFlagContent = "Script: $scriptName`nStart Time: $startTime"
-New-Item -Path $busyFlagPath -ItemType File -Force > null
-Set-Content -Path $busyFlagPath -Value $busyFlagContent > null
-
-<#== Get current date and time ==#>
-Write-Host "Getting current date and time..."
-$currentDateTime = Get-Date -Format "yyyy-MM-dd_HHmm"
-
-# Determine the name of the currently executing script without the extension
-$scriptNameWithoutExtension = [System.IO.Path]::GetFileNameWithoutExtension($MyInvocation.MyCommand.Name)
-
-<#== Start Transcript ==#>
-Write-Host "Starting transcript..."
-$transcriptPath = "C:\Install Logs\$scriptNameWithoutExtension_$currentDateTime.log"
-Start-Transcript -Path $transcriptPath
+New-Item -Path $busyFlagPath -ItemType File -Force > $null
+Set-Content -Path $busyFlagPath -Value $busyFlagContent > $null
 
 <#== Apply random delay if enabled ==#>
 if ($EnableRandomDelay) {
@@ -73,7 +72,7 @@ Write-Host "Chocolatey upgrade completed."
 
 <#== Remove old log files ==#>
 Write-Host "Removing old log files..."
-Remove-OldLogFiles -logPath "C:\Install Logs" -maxFiles 45 -scriptNameWithoutExtension $scriptNameWithoutExtension
+Remove-OldLogFiles -logPath "C:\Install Logs" -maxFiles 45 -scriptName $scriptName
 
 <#== Stop Transcript ==#>
 Write-Host "Stopping transcript..."