Skip to content

Add clean up function to Update-Engines.ps1 script#2309

Merged
dpaulson45 merged 4 commits into
microsoft:mainfrom
christophvw:main
Apr 30, 2025
Merged

Add clean up function to Update-Engines.ps1 script#2309
dpaulson45 merged 4 commits into
microsoft:mainfrom
christophvw:main

Conversation

@christophvw
Copy link
Copy Markdown
Contributor

add clean up function to prevent running out of diskspace on the server

Issue:
server runs out of diskspace when the script is run as schedules task

Reason:
to prevent running out of diskspace on the server

Fix:
add cleanup function

add clean up function to prevent running out of diskspace on the server
@christophvw christophvw requested a review from a team as a code owner April 11, 2025 10:22
Comment thread Admin/Update-Engines.ps1 Outdated
}

function CleanUpFolder($path, $itemsToKeep) {
Get-ChildItem $path | ? { $_.PSIsContainer } | Sort-Object -Property CreationTime -Descending | Select-Object -Skip $itemsToKeep | Remove-Item -Recurse
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't use alias for cmdlets. Need to use Where-Object not ?.

@dpaulson45
Copy link
Copy Markdown
Member

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@dpaulson45 dpaulson45 added the Test Team Need to get the test involved and aware of this. label Apr 30, 2025
@lusassl-msft
Copy link
Copy Markdown
Contributor

I did a quick sanity check and the code change seems to work as expected. Since this is an optional feature (default behavior remains unchanged), we should be good to merge this PR.

@lusassl-msft lusassl-msft requested a review from dpaulson45 April 30, 2025 15:33
@lusassl-msft lusassl-msft changed the title add clean up function Add clean up function to Update-Engines.ps1 script Apr 30, 2025
@lusassl-msft lusassl-msft added Enhancement New feature or request and removed Test Team Need to get the test involved and aware of this. labels Apr 30, 2025
Copy link
Copy Markdown
Contributor

@lusassl-msft lusassl-msft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new parameters should be added to the script documentation: https://microsoft.github.io/CSS-Exchange/Admin/Update-Engines/

Update syntax for cleanup function
@lusassl-msft
Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@dpaulson45 dpaulson45 requested a review from lusassl-msft April 30, 2025 19:17
@dpaulson45 dpaulson45 merged commit f607915 into microsoft:main Apr 30, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants