Automate This
Use the Attune GUI for your Scripts
You've automated: Cleanup Windows Worker
Get the most out of automation with our get started videos, product demonstrations, and more.
The following steps will guide you through the manual process.
https://stackoverflow.com/questions/18847145/loop-through-files-in-a-directory-using-powershell
Connect via RDP:
mstsc /admin /v:{automationworkerwindowsnode}
Login as user {automationworkerwindowsuseradministrator} and open a command prompt.
Execute the following script:
$DIR="{automationWorkerWindowsBaseDirectory}"
if (Test-Path $DIR) {
Set-Location "${DIR}"
} else {
New-Item -Path '${DIR}' -ItemType Directory
Test-Path '${DIR}'
}
$DIR="build-{newOsNode.fqn}"
if (Test-Path $DIR) {
Remove-Item -Recurse $DIR -Force
} else {
Write-Host "No build directory to remove."
}
# The wildcard will allow removal of
# - kickstart_{newOsNode.fqn}.iso
# - drivers_{newOsNode.fqn}.iso
$ISOS="*{newOsNode.fqn}.iso"
if (test-Path "${ISOS}" -pathtype leaf) {
Get-ChildItem "${ISOS}" | `
Foreach-Object {
if (test-Path $_.Name -pathtype leaf) {
Write-Host $_.Name
Remove-Item $_.Name
}
}
} else {
Write-Host "No ISOs to remove, skipping."
}
You have completed this instruction.
Join our Discord channel and connect with like-minded individuals who share your passion. Engage in lively discussions, gain valuable insights, and stay updated on the latest trends in our industry. Don't miss out on this opportunity to network, learn, and grow together.
Click the link below and become a part of our vibrant community on Discord today!