-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathLimpieza_WSUS.ps1
30 lines (23 loc) · 969 Bytes
/
Limpieza_WSUS.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# Variables
# Parametros Conexion WSUS:
[String]$updateServer = "WSUS-R-38"
[Boolean]$useSecureConnection = $False
[Int32]$portNumber = 80
# Parametros de Limpieza:
[Boolean]$supersededUpdates = $True
[Boolean]$expiredUpdates = $True
[Boolean]$obsoleteUpdates = $True
[Boolean]$compressUpdates = $True
[Boolean]$obsoleteComputers = $True
[Boolean]$unneededContentFiles = $True
#FIN VARIABLES
#SCRIPT
# Load .NET assembly
[void][reflection.assembly]::LoadWithPartialName("Microsoft.UpdateServices.Administration")
# conexion con WSUS
$Wsus = [Microsoft.UpdateServices.Administration.AdminProxy]::getUpdateServer($updateServer,$useSecureConnection,$portNumber)
# Limpieza
$CleanupManager = $Wsus.GetCleanupManager()
$CleanupScope = New-Object Microsoft.UpdateServices.Administration.CleanupScope($supersededUpdates,$expiredUpdates,$obsoleteUpdates,$compressUpdates,$obsoleteComputers,$unneededContentFiles)
$CleanupManager.PerformCleanup($CleanupScope)
#FIN SCRIPT