Pour rappel la mise à jour d'un client SCCM via l'interface graphique peut se faire en lançant Configuration manager
Il faut ensuite lancer "Récupération de stratégie ordinateur et cycle d'évaluation"
En powershell, le script ci-dessous utilise l'objet CPApplet.CPAppletMgr
# DECLARATION DE FONCTIONS
Function Get-Actions($actions){
$actions | select Name
}
Function Execute-Action($actions,$name){
[ARRAY]$actionToPerform = $null
if(($name -eq "all") -AND ($actions -ne $null)){
foreach($action in $actions){
$actionToPerform += $action
}
}
else {
$actionToPerform += $actions | ?{$_.Name -like $name}
}
if($actionToPerform -ne $null){
foreach($action in $actionToPerform) {
Write-Host (">> Executing : " + ($action.Name))
$action.PerformAction()
}
}
else {
Write-Host "Unable to run client action : $name"
}
}
function Get-AllActions ($actions){
Execute-Action $actions "all"
}
function Get-MachinePolicy ($actions){
Execute-Action $actions "*Machine Policy"
}
Function Get-UserPolicy ($actions){
Execute-Action $actions "*User Policy"
}
Function Update-CollectionCycle ($actions){
Execute-Action $actions "*Collection Cycle"
}
Function Update-MSI ($actions){
Execute-Action $actions "MSI*"
}
Function Update-WSUS ($actions){
Execute-Action $actions "Software Updates*"
}
Function Update-Source ($actions){
Execute-Action $actions "Updates Source*"
}
Function Report-SoftwareMetering ($actions){
Execute-Action $actions "Software Metering*"
}
Function Execute-Action($actions,$name){
[ARRAY]$actionToPerform = $null
if(($name -eq "all") -AND ($actions -ne $null)){
foreach($action in $actions){
$actionToPerform += $action
}
}
else {
$actionToPerform += $actions | ?{$_.Name -like $name}
}
if($actionToPerform -ne $null){
foreach($action in $actionToPerform) {
Write-Host (">> Executing : " + ($action.Name))
$action.PerformAction()
}
}
else {
Write-Host "Unable to run client action : $name"
}
}
# -----------------------------------------------------
# UPDATE SCCM TO RUN
# -----------------------------------------------------
$sms_client = New-Object -COM 'CPApplet.CPAppletMgr'
$actions = $sms_client.GetClientActions()
Write-host -FORE RED "# -----------------------------------------------------"
Write-host -FORE RED ("# UPDATING SCCM CLIENT " + (get-date -uFormat "%Y %H:%M:%S"))
Write-host -FORE RED "# -----------------------------------------------------"
Write-host -FORE RED " "
Get-AllActions $actions
pause
Lien vers le fichier : cliquez ici
Cette simple commande powershell lance "Récupération de stratégie ordinateur et cycle d'évaluation"
Invoke-WmiMethod -Namespace "Root\CCM" -Class SMS_Client -Name TriggerSchedule -ArgumentList "{00000000-0000-0000-0000-000000000021}"
Lien vers le fichier : cliquez ici
Et voici une tentative de tous les déclencher, sachant qu'ici il y en a 14 alors que 11 sont indiqués dans l'interface graphique
Invoke-WmiMethod -Namespace "Root\CCM" -Class SMS_Client -Name TriggerSchedule -ArgumentList "{00000000-0000-0000-0000-000000000121}"
Invoke-WmiMethod -Namespace "Root\CCM" -Class SMS_Client -Name TriggerSchedule -ArgumentList "{00000000-0000-0000-0000-000000000003}"
Invoke-WmiMethod -Namespace "Root\CCM" -Class SMS_Client -Name TriggerSchedule -ArgumentList "{00000000-0000-0000-0000-000000000010}"
Invoke-WmiMethod -Namespace "Root\CCM" -Class SMS_Client -Name TriggerSchedule -ArgumentList "{00000000-0000-0000-0000-000000000001}"
Invoke-WmiMethod -Namespace "Root\CCM" -Class SMS_Client -Name TriggerSchedule -ArgumentList "{00000000-0000-0000-0000-000000000021}"
Invoke-WmiMethod -Namespace "Root\CCM" -Class SMS_Client -Name TriggerSchedule -ArgumentList "{00000000-0000-0000-0000-000000000022}"
Invoke-WmiMethod -Namespace "Root\CCM" -Class SMS_Client -Name TriggerSchedule -ArgumentList "{00000000-0000-0000-0000-000000000002}"
Invoke-WmiMethod -Namespace "Root\CCM" -Class SMS_Client -Name TriggerSchedule -ArgumentList "{00000000-0000-0000-0000-000000000031}"
Invoke-WmiMethod -Namespace "Root\CCM" -Class SMS_Client -Name TriggerSchedule -ArgumentList "{00000000-0000-0000-0000-000000000108}"
Invoke-WmiMethod -Namespace "Root\CCM" -Class SMS_Client -Name TriggerSchedule -ArgumentList "{00000000-0000-0000-0000-000000000113}"
Invoke-WmiMethod -Namespace "Root\CCM" -Class SMS_Client -Name TriggerSchedule -ArgumentList "{00000000-0000-0000-0000-000000000111}"
Invoke-WmiMethod -Namespace "Root\CCM" -Class SMS_Client -Name TriggerSchedule -ArgumentList "{00000000-0000-0000-0000-000000000026}"
Invoke-WmiMethod -Namespace "Root\CCM" -Class SMS_Client -Name TriggerSchedule -ArgumentList "{00000000-0000-0000-0000-000000000027}"
Invoke-WmiMethod -Namespace "Root\CCM" -Class SMS_Client -Name TriggerSchedule -ArgumentList "{00000000-0000-0000-0000-000000000032}"
Lien vers le fichier : cliquez ici
Pages Web
Site Web | Description |
---|---|
Systemcenterdudes.com | Site indiquant des lignes de commande pour SCCM |
Article(s) en relation(s)