Book Image

Windows Server 2016 Automation with PowerShell Cookbook - Second Edition

By : Thomas Lee, Ed Goad
Book Image

Windows Server 2016 Automation with PowerShell Cookbook - Second Edition

By: Thomas Lee, Ed Goad

Overview of this book

This book showcases several ways that Windows administrators can use to automate and streamline their job. You'll start with the PowerShell and Windows Server fundamentals, where you'll become well versed with PowerShell and Windows Server features. In the next module, Core Windows Server 2016, you'll implement Nano Server, manage Windows updates, and implement troubleshooting and server inventories. You'll then move on to the Networking module, where you'll manage Windows network services and network shares. The last module covers Azure and DSC, where you will use Azure on PowerShell and DSC to easily maintain Windows servers.
Table of Contents (21 chapters)
Title Page
Credits
About the Author
Acknowledgment
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface

Restore files and folders


Performing backups is great, but backups are only useful if you can use them to restore files and folders. The reasons for restoring include recovering from a major system disaster, recovering from a single disk failure, or just restoring a file a user has inadvertently deleted.

In the previous recipe, you saw how you could mount the VHDX that WSB created for you and give it a drive letter. So one way to recover the file is just to mount the backup VHDX and then use Explorer or other tools to copy files from the backup to a new home. This recipe uses the WSB cmdlets to recover to a separate folder. You would do this if you wanted to recover some particular files and did not want to overwrite anything.

Getting ready

In this recipe, you first create a new backup policy and start it to create a backup. This script, which is derived from the recipe Configure and set a backup policy, is as follows:

If (Get-WBPolicy) {Remove-WBPolicy -All}
   If (-NOT (Test-Path C:food1.txt...