Add clean up function to Update-Engines.ps1 script#2309
Merged
Conversation
add clean up function to prevent running out of diskspace on the server
dpaulson45
reviewed
Apr 14, 2025
| } | ||
|
|
||
| function CleanUpFolder($path, $itemsToKeep) { | ||
| Get-ChildItem $path | ? { $_.PSIsContainer } | Sort-Object -Property CreationTime -Descending | Select-Object -Skip $itemsToKeep | Remove-Item -Recurse |
Member
There was a problem hiding this comment.
Can't use alias for cmdlets. Need to use Where-Object not ?.
Member
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
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
requested changes
Apr 30, 2025
Contributor
lusassl-msft
left a comment
There was a problem hiding this comment.
The new parameters should be added to the script documentation: https://microsoft.github.io/CSS-Exchange/Admin/Update-Engines/
Update syntax for cleanup function
Contributor
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
dpaulson45
approved these changes
Apr 30, 2025
lusassl-msft
approved these changes
Apr 30, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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