Skip to content

Instantly share code, notes, and snippets.

@isarns
Created March 14, 2021 09:33
Show Gist options
  • Save isarns/8894145bb408b12956170f8c3cc6d24d to your computer and use it in GitHub Desktop.
Save isarns/8894145bb408b12956170f8c3cc6d24d to your computer and use it in GitHub Desktop.
Sccm BackUp
$backup_path="C:\SccmBackUp"
$sccm_Installation_Path="C:\Program Files\Microsoft Configuration Manager"
$date=get-date -Format dd.MM.yy
## Backup Files And Folders
mkdir "$backup_path\BackUp_$($date)"
$back_path="$backup_path\BackUp_$($date)"
write-host("`n`n`n`n`n`n`n`n***********************************")
write-host("Copying the SCCM files and folders:`n")
write-host("Copying ADMINUICONTENTSTAGING")
copy-item -path "$($sccm_Installation_Path)\ADMINUICONTENTSTAGING" -Destination "$($back_path)\ADMINUICONTENTSTAGING" -Recurse
write-host("Copying Inboxes")
copy-item -path "$($sccm_Installation_Path)\Inboxes" -Destination "$($back_path)\Inboxes" -Recurse
write-host("Copying logs")
copy-item -path "$($sccm_Installation_Path)\logs" -Destination "$($back_path)\logs" -Recurse
write-host("Copying data")
copy-item -path "$($sccm_Installation_Path)\data" -Destination "$($back_path)\data" -Recurse
write-host("Copying srvacct")
copy-item -path "$($sccm_Installation_Path)\srvacct" -Destination "$($back_path)\srvacct" -Recurse
write-host("Copying install.map")
mkdir "$($back_path)\SMSServer\"
copy-item "$($sccm_Installation_Path)\install.map" -Destination "$($back_path)\SMSServer\install.map"
write-host("Copying cd.latest")
copy-item -path "$($sccm_Installation_Path)\cd.latest" -Destination "$($back_path)\cd.latest" -Recurse
## Backup Regestry
mkdir "$back_path\Registry_backup"
$back_path="$back_path\Registry_backup"
write-host("`n`n`n`n`n`n`n`n***********************************")
write-host("Copying the SCCM Regestry")
REG EXPORT 'HKLM\SOFTWARE\Microsoft\SMS' "$($back_path)\SMS.reg"
REG EXPORT 'HKLM\SYSTEM\CurrentControlSet\Services\SMS_DISCOVERY_DATA_MANAGER' "$($back_path)\SMS_DISCOVERY_DATA_MANAGER.reg"
REG EXPORT 'HKLM\SYSTEM\CurrentControlSet\Services\SMS_EXECUTIVE' "$($back_path)\SMS_EXECUTIVE.reg"
REG EXPORT 'HKLM\SYSTEM\CurrentControlSet\Services\SMS_INBOX_MONITOR' "$($back_path)\SMS_INBOX_MONITOR.reg"
REG EXPORT 'HKLM\SYSTEM\CurrentControlSet\Services\SMS_INVENTORY_DATA_LOADER' "$($back_path)\SMS_INVENTORY_DATA_LOADER.reg"
REG EXPORT 'HKLM\SYSTEM\CurrentControlSet\Services\SMS_LAN_SENDER' "$($back_path)\SMS_LAN_SENDER.reg"
REG EXPORT 'HKLM\SYSTEM\CurrentControlSet\Services\SMS_MP_FILE_DISPATCH_MANAGER' "$($back_path)\SMS_MP_FILE_DISPATCH_MANAGER.reg"
REG EXPORT 'HKLM\SYSTEM\CurrentControlSet\Services\SMS_NOTIFICATION_MANAGER' "$($back_path)\SMS_NOTIFICATION_MANAGER.reg"
REG EXPORT 'HKLM\SYSTEM\CurrentControlSet\Services\SMS_NOTIFICATION_SERVER' "$($back_path)\SMS_NOTIFICATION_SERVER.reg"
REG EXPORT 'HKLM\SYSTEM\CurrentControlSet\Services\SMS_SCHEDULER' "$($back_path)\SMS_SCHEDULER.reg"
REG EXPORT 'HKLM\SYSTEM\CurrentControlSet\Services\SMS_SITE_BACKUP' "$($back_path)\SMS_SITE_BACKUP.reg"
REG EXPORT 'HKLM\SYSTEM\CurrentControlSet\Services\SMS_SITE_COMPONENT_MANAGER' "$($back_path)\SMS_SITE_COMPONENT_MANAGER.reg"
REG EXPORT 'HKLM\SYSTEM\CurrentControlSet\Services\SMS_SITE_SQL_BACKUP' "$($back_path)\SMS_SITE_SQL_BACKUP.reg"
REG EXPORT 'HKLM\SYSTEM\CurrentControlSet\Services\SMS_SITE_VSS_WRITER' "$($back_path)\SMS_SITE_VSS_WRITER.reg"
REG EXPORT 'HKLM\SYSTEM\CurrentControlSet\Services\SMS_SOFTWARE_INVENTORY_PROCESSOR' "$($back_path)\SMS_SOFTWARE_INVENTORY_PROCESSOR.reg"
REG EXPORT 'HKLM\SYSTEM\CurrentControlSet\Services\SMS_SOFTWARE_METERING_PROCESSOR' "$($back_path)\SMS_SOFTWARE_METERING_PROCESSOR.reg"
REG EXPORT 'HKLM\SYSTEM\CurrentControlSet\Services\SMS_STATE_SYSTEM' "$($back_path)\SMS_STATE_SYSTEM.reg"
REG EXPORT 'HKLM\SYSTEM\CurrentControlSet\Services\SMS_STATUS_MANAGER' "$($back_path)\SMS_STATUS_MANAGER.reg"
REG EXPORT 'HKLM\SYSTEM\CurrentControlSet\Services\SMS_WSUS_SYNC_MANAGER' "$($back_path)\SMS_WSUS_SYNC_MANAGER.reg"
REG EXPORT 'HKLM\SYSTEM\CurrentControlSet\Services\SmsMP' "$($back_path)\SmsMP.reg"
REG EXPORT 'HKLM\SYSTEM\CurrentControlSet\Services\SmsMPInventory' "$($back_path)\SmsMPInventory.reg"
REG EXPORT 'HKLM\SYSTEM\CurrentControlSet\Services\SMSvcHost 3.0.0.0' "$($back_path)\SMSvcHost 3.0.0.0.reg"
REG EXPORT 'HKLM\SYSTEM\CurrentControlSet\Services\SMSvcHost 4.0.0.0' "$($back_path)\SMSvcHost 4.0.0.0.reg"
write-host("****DONE****")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment