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.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
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 )
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
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/