import depuis ancien GitHub

This commit is contained in:
David Wuibaille
2025-10-31 08:38:13 +01:00
parent 6f3aeedc93
commit 6a2f2de58e
745 changed files with 178444 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
# Remove Old Scheduled Tasks (Ivanti EPM)
Deletes outdated **scheduled tasks** from Ivanti EPM based on the next run date in `LD_TASK`, with simple name-based exclusions, via MBSDK (`MsgSDK.asmx`).
## Requirements
- Windows PowerShell 5.1
- Read access to SQL database `LDMS` (table `dbo.LD_TASK`)
- Network access to the EPM Core MBSDK endpoint
- Account permitted to delete tasks via MBSDK
## Configure (top of script)
```powershell
$dataSource = "InstanceBDD" # SQL Server/instance
$user = "usrlandeskRead" # SQL read-only login
$PassSQL = "password" # SQL password
$database = "LDMS" # Database
$mycreds = Get-Credential -Credential "domaine\\dwuibail_adm" # EPM account
$ldWS = New-WebServiceProxy -Uri "http://serverlandesk.leblogosd.lan/MBSDKService/MsgSDK.asmx?WSDL" -Credential $mycreds
```
## Behavior
Loads dbo.LD_TASK and iterates tasks:
-- Default retention: 30 days
-- Skips names matching *PORTAL* and *Download patch content*
When NEXT_START is older than retention, calls:
-- $ldWS.DeleteTask($taskid)
## Run
```powershell
powershell.exe -NoProfile -ExecutionPolicy Bypass -File .\Remove-OldScheduledTasks.ps1
```