Our Story

Who we are and how we solve complex IT challenges.

Our Certifications

Microsoft certifications and partnerships validating our technical expertise.

Leadership

Meet the Experienced Leadership Team Driving WME’s Success

Advisory Updates

Expert guidance on Microsoft, security, and compliance developments.

Case Studies

Real-world outcomes from complex Microsoft-focused IT engagements.

Podcast

Podcasts, panels, and interviews where WME leaders share how they help high-growth companies and IT partners scale.

Ebooks

Practical guides on the Microsoft moves you can’t afford to get wrong.

Financial Industry

Secure technology solutions for regulated banks and financial institutions.

Healthcare

Secure Microsoft solutions for compliant, connected, and modern healthcare organizations.

Manufacturing

Cloud and security solutions supporting modern manufacturing operations.

Non-Profit

Cost-efficient Microsoft solutions for mission-driven organizations.

Public Sector

Microsoft-based IT services for secure public sector modernization.

High Tech

Scalable cloud, security, and staffing for fast-growing technology companies.

SMBs

Scalable cloud, security, and staffing for fast-growing technology companies.

Cloud Migration Services

Transition your workloads to the cloud securely for greater scalability and performance.

Data Migration Services

Securely transfer your business data with minimal downtime and maximum integrity.

Application Migration Services

Move your applications seamlessly to modern platforms with minimal business disruption.

Identity & Security Migration Services

Strengthen identity management and security while transitioning to modern Microsoft solutions.

Security Solutions

Protect your business with proactive cybersecurity, compliance, and risk management solutions.

Endpoint Management

Secure, manage, and monitor every device with modern endpoint management solutions.

Licensing Optimization

Get discounted pricing, a dedicated licensing team, and a plan that fits how many seats you actually use.

Power Platform

Unlock the full potential of the Microsoft Power Platform Suite to streamline operations, automate repetitive tasks, and gain real-time insights that drive business growth.

Sharepoint Solutions

Supercharge your business productivity and enhance visibility through our proven SharePoint expertise.

IT Staffing

Connect with skilled IT professionals to strengthen your team and accelerate project delivery.

Accounting & Finance

Connect with experienced accounting and finance professionals to support your business goals.

Retain ConfigMgr Backups

March 8, 2017

The backup maintenance task in ConfigrMgr is great. It gives you everything you need to restore your site. The only problem with it is that it only retains one copy of the backup, so you can’t go back days, weeks, or months to restore your environment. You can only go back to your most recent backup. Usually that’s OK, but what if that backup is corrupted, or it didn’t get a clean copy of the database? Then you could be left in a situation where you cannot restore your site.

Here is a simple PowerShell script that will keep (by default) three backups:

# create PowerShell drive for backup directory
new-psdrive -name backup -PSProvider FileSystem -root “<backup drive>”

# number of days to retain backups
$retain_count = 3

# get and format date
$date = get-date -format yyyyMMdd

rename-item backup:\<site code>Backup <site code>Backup-$date

# remove old backups
If ( (get-childitem -path backup:\).count -gt $retain_count ) {
Do { get-childitem backup:\ | select-object -first 1 | remove-item -recurse -force }
Until ( (get-childitem -path backup:\).count -eq $retain_count )
}

To change the retention, modify the line “$retain_count = 3” to the number of backups that you want to retain. For example, if I wanted to retain 7 backups, it would read:

$retain_count = 7

Also be sure to input the correct information where the text is red. First, the drive where you want the backup stored. This should match the backup location you specify in the Backup Site Maintenance task.

For the rename-item line, if my site code were 787, the line would be typed like this:

rename-item backup:\787Backup 787Backup-$date

Finally, to execute the PowerShell script after a backup, you need to modify the AfterBackup.bat file, located on your primary site server at “<ConfigMgr InstallDir>\inboxes\smsbkup.box”. Add this to the file:

@ECHO OFF

C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe -executionpolicy bypass -noexit -command “. ‘<full path to PowerShell script>'”

Be sure to replace the part in red with the path to your PowerShell script. For example:

C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe -executionpolicy bypass -noexit -command “. ‘D:\scripts\retain-sccm-backups.ps1′”

Disclaimer
All content provided on this blog is for information purposes only. Windows Management Experts, Inc makes no representation as to accuracy or completeness of any information on this site. Windows Management Experts, Inc will not be liable for any errors or omission in this information nor for the availability of this information. It is highly recommended that you consult one of our technical consultants, should you need any further assistance.

Share:

Facebook
Twitter
LinkedIn

Get Microsoft Updates Before They Cost You Downtime

Retirement dates, licensing changes, and security updates from a Microsoft-exclusive team, sent when they matter, not on a filler schedule.

Related Posts

Get Microsoft Updates Before They Cost You Downtime

Retirement dates, licensing changes, and security updates from a Microsoft-exclusive team, sent when they matter, not on a filler schedule.
Subscription Form email