Skip to content
Snippets Groups Projects
Commit 8f8869c4 authored by Andreas Lindemark's avatar Andreas Lindemark
Browse files

Removed the EnableRandomDelay functionallity

parent 0be5c65e
No related branches found
No related tags found
No related merge requests found
...@@ -2,11 +2,6 @@ ...@@ -2,11 +2,6 @@
Upgrade programs with Chocolatey by running "choco upgrade -y all" at computer startup and nightly Upgrade programs with Chocolatey by running "choco upgrade -y all" at computer startup and nightly
======================================================================================================#> ======================================================================================================#>
<#== Set parameter at start ==#>
param (
[bool]$EnableRandomDelay = $false
)
<#== Function to remove old log files ==#> <#== Function to remove old log files ==#>
function Remove-OldLogFiles { function Remove-OldLogFiles {
param ( param (
...@@ -57,13 +52,6 @@ $busyFlagContent = "Script: $scriptName`nStart Time: $startTime" ...@@ -57,13 +52,6 @@ $busyFlagContent = "Script: $scriptName`nStart Time: $startTime"
New-Item -Path $busyFlagPath -ItemType File -Force > $null New-Item -Path $busyFlagPath -ItemType File -Force > $null
Set-Content -Path $busyFlagPath -Value $busyFlagContent > $null Set-Content -Path $busyFlagPath -Value $busyFlagContent > $null
<#== Apply random delay if enabled ==#>
if ($EnableRandomDelay) {
$randomDelay = Get-Random -Minimum 0 -Maximum 300 # Random delay between 0 and 300 seconds (5 minutes)
Write-Host "Applying random delay of $randomDelay seconds..."
Start-Sleep -Seconds $randomDelay
}
<#== Upgrade all Chocolatey packages ==#> <#== Upgrade all Chocolatey packages ==#>
Write-Host "Starting Chocolatey upgrade..." Write-Host "Starting Chocolatey upgrade..."
powershell.exe choco upgrade -y all powershell.exe choco upgrade -y all
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment