Simple script to backup device/user collections list from SCCM

Question

Hi All,
I am looking for simple script or steps to schedule in SCCM server to backup device/user collections lists.

Appreciate if anyone share the script or steps. Thank You.

Answers ( 2 )

    1
    2021-02-12T16:41:54+05:30

    Maybe on late side, but you should start DevOps’ing (Device) Collections or at least start using:
    https://github.com/prae1809/PowerShell-Scripts/tree/master/OperationalCollections

    And to answer your question: Use this to backup/dump all your device collections:

    Export-CMCollection -Name * -ExportFilePath “c:\temp\ExportedCollections.mof” –Verbose –ForceWildcardHandling #-WhatIf

    Best answer
  1. I think the best way to use something like this using wmi

    $CMCollection = ([WMIClass]”\\LDCM01\root\sms\site_P35:SMS_Collection”).CreateInstance()

    More details https://devblogs.microsoft.com/scripting/use-wmi-and-powershell-to-create-collection-query-rules/

Leave an answer

Sorry, you do not have permission to answer to this question .