Hello Marc,
this should be OK as a start for what you're looking for, just adapt it to your use case
$RenPat = (Get-Culture).DateTimeFormat.GetAbbreviatedMonthName((Get-Date).AddMonths(-1).Month)
if (Test-Path 'c:\temp\setup.exe') {
Rename-Item 'c:\temp\setup.exe' -NewName $RenPat"_setup.exe"
}
Invoke-WebRequest -Uri 'https://github.com/notepad-plus-plus/notepad-plus-plus/releases/download/v8.5.3/npp.8.5.3.Installer.x64.exe' -OutFile 'c:\temp\setup.exe'
Get-ChildItem -Path 'c:\temp\' | Where-Object { ($_.Name -like '*_Setup.exe') -and ($_.LastWriteTime -lt (Get-Date).AddMonths(-6)) } | Remove-Item