Windows server backup powershell

Windows Server Backup

This reference provides cmdlet descriptions and syntax for all Windows Server Backup cmdlets. It lists the cmdlets in alphabetical order based on the verb at the beginning of the cmdlet.

WindowsServerBackup

Adds a backup target to a backup policy.

Adds items to a backup policy so that backups that use the policy can perform bare metal recoveries.

Adds a backup file specification to a backup policy.

Adds the system state components to the backup policy.

Adds a list of virtual machines to the backup policy.

Adds the list of source volumes to the backup policy.

Gets backups for a server from a location that you specify.

Gets backup storage locations that you specified as part of a backup policy.

Mounts a volume inside a backup so that you can browse the files on the volume.

Gets a Boolean value that indicates whether or not a backup policy can perform bare metal recoveries from backups.

Gets a list of internal and external disks that are online for the local computer.

Gets the list of backup file specifications associated with a backup policy.

Gets the current backup operation.

Gets the current volume backup performance settings.

Gets the current backup policy for the computer.

Gets the current schedule for backups.

Gets the history of backup operations on the computer.

Gets a Boolean value that indicates whether system state recovery was added to the backup policy.

Gets all virtual machines and components from the backup policy.

Gets a list of volumes.

Gets a VSS setting from the backup policy.

Creates a backup target object.

Creates a backup file specification.

Creates a backup policy object.

Removes backups from a target catalog, a system catalog, or both.

Removes backup storage locations from a backup policy.

Removes a request to include items that implement bare metal recovery from the current backup policy.

Removes the backup catalog from the local computer.

Removes a backup file specification from a backup policy.

Removes the backup policy.

Removes the system state components from the backup policy.

Removes the list of virtual machines from the backup policy.

Removes the volume from the backup policy.

Restores a backup catalog for the local computer from a storage location.

Resumes a backup operation to a removable device after you add media to the device.

Resumes a volume recovery operation from a removable device and specific media.

Sets the current volume backup performance settings.

Sets the backup policy for scheduled backups.

Sets the current schedule for backups.

Sets a value that determines the VSS setting in the backup policy.

Starts an application recovery operation.

Starts a one-time backup operation.

Starts a file recovery operation.

Starts recovery of a Hyper-V Server 2016 virtual machine.

Windows server backup powershell

Главное меню

Авторизация

Теги сайта

В данной статье я продемонстрирую как от начала до конца настроить резервное копирование в Windows Server 2012 Core. Бэкапить будем на iSCSI хранилище.

Итак, нам нужно будет настроить три компонента:

  • [PowerShell] Microsoft iSCSI Initiator
  • [DiskPart] Подготовка раздела для бэкапов к работе с Windows Server Backup
  • [PowerShell] Установка и настройка Windows Server Backup Feature
Читайте также:  Установка windows с usb acer one

1. Microsoft iSCSI Initiator

Хочу отметить, что даже в Server Core версии Вы можете получить привычную графическую оснастку iSCSI, вызвав её в командной строке с помощью команды iscsicpl.exe . Столкнуться с отсутствием графической оснастки iSCSI можно в версиях WinPE и WinRE.

Настроим iSCSI Initiator с помощью PowerShell:

Настройка инициатора окончена.

2. Подготовка раздела для бэкапов к работе с Windows Server Backup

Перед тем как приступать к конфигурированию самого бэкапа, нужно наш уже подключенный iSCSI раздел предварительно причесать с помощью DiskPart, дабы избежать ошибок типа:

DiskPart has encountered an error: The media is write protected.

Set-WBPolicy : Formatting the disk has failed. Please ensure the disk is online and accessible. Unknown error (0x8004280a)

Теперь все готово для настройки бэкапа.

Установка и настройка Windows Server Backup Feature

Посмотрим настроенные параметры и результаты выполнения бэкапа

Примечание

При планировании стратегии развертывания из Bare Metal Recovery резервной копии Windows Server Backup, нужно учитывать что восстановить такую копию будет возможно только на диск, который по размеру соответствует или превышает исходный. Другими словами, если Вы бэкапите диск C: размером 500 Гб, на котором свободно 450 Гб, для успешного восстановления из Bare Metal Recovery резервной копии Вам потребуется новый диск не менее пол террабайта.

Как восстановить систему из созданного нами образа с Bare Metal Recovery

Это я подробно описал в своей статье (ссылка).

Командлеты Windows PowerShell для резервного копирования и восстановления ЦС CA Backup and Restore Windows PowerShell cmdlets

Область применения. Windows Server 2016, Windows Server 2012 R2, Windows Server 2012 Applies To: Windows Server 2016, Windows Server 2012 R2, Windows Server 2012

Автор: Джастин Тернер, старший инженер по расширению поддержки с группой Windows Author: Justin Turner, Senior Support Escalation Engineer with the Windows group

Этот материал создан инженером службы поддержки клиентов Майкрософт и предназначен для опытных администраторов и архитекторов систем, которым нужны более глубокие технические сведения о функциях и решениях в Windows Server 2012 R2, а не обычная информация, доступная в статьях на сайте TechNet. This content is written by a Microsoft customer support engineer, and is intended for experienced administrators and systems architects who are looking for deeper technical explanations of features and solutions in Windows Server 2012 R2 than topics on TechNet usually provide. Однако он не был отредактирован согласно требованиям сайта, поэтому некоторые формулировки могут быть не такими выверенными, как на станицах TechNet. However, it has not undergone the same editing passes, so some of the language may seem less polished than what is typically found on TechNet.

Обзор Overview

Модуль Адксадминистратион Windows PowerShell появился в Window Server 2012. The ADCSAdministration Windows PowerShell module was introduced in Window Server 2012. В этот модуль в Windows Server 2012 R2 были добавлены два новых командлета для поддержки резервного копирования и восстановления центра сертификации. Two new cmdlets were added to this module in Window Server 2012 R2 to support the Backup and Restore of a CA.

Backup-CARoleService Backup-CARoleService

Таблица SEQ таблица \ * арабский 17: командлеты Backup и RESTORE Windows PowerShell Table SEQ Table \* ARABIC 17: Backup and Restore Windows PowerShell Cmdlets

Командлет Адксадминистратион: Backup-Каролесервице ADCSAdministration Cmdlet: Backup-CARoleService

Читайте также:  Написание модулей ядра linux
Аргументы — требуются аргументы полужирного шрифта Arguments — Bold arguments are required Описание Description
-Path -Path -Строка — место для сохранения резервной копии — String — location to save the backup
— Это единственный безымянный параметр. — This is the only unnamed parameter
-Позиционированный параметр — positional parameter

Пример. Example:

Backup-Каролесервице.-путь c:\adcsbackup1 Backup-CARoleService.-Path c:\adcsbackup1

Backup-CARoleService c:\adcsbackup2 Backup-CARoleService c:\adcsbackup2

-Кэйонли -KeyOnly — Резервное копирование сертификата ЦС без базы данных; — Backup the CA certificate without the database

Пример. Example:

Backup-CARoleService c:\adcsbackup3 — Кэйонли Backup-CARoleService c:\adcsbackup3 -KeyOnly

-Password -Password — Указывает пароль для защиты сертификатов ЦС и закрытых ключей. — Specifies the password to protect CA certificates and private keys
— Должна быть защищенной строкой — Must be a secure string
-Недопустимо с параметром-Датабасеонли — Not valid with the -DatabaseOnly parameter

Backup-CARoleService c:\adcsbackup4-Password (чтение-хост-запрос «пароль:»-AsSecureString) Backup-CARoleService c:\adcsbackup4 -Password (Read-Host -prompt «Password:» -AsSecureString)

Backup-CARoleService c:\adcsbackup5-Password (ConvertTo-SecureString «Pa55w0rd!» Backup-CARoleService c:\adcsbackup5 -Password (ConvertTo-SecureString «Pa55w0rd!» -AsPlainText-Force) -AsPlainText -Force)

-Датабасеонли -DatabaseOnly — Резервное копирование базы данных без сертификата ЦС; — Backup the database without the CA certificate

Backup-CARoleService c:\adcsbackup6 — Датабасеонли Backup-CARoleService c:\adcsbackup6 -DatabaseOnly

-Force -Force 1. позволяет перезаписать резервную копию, которая существует в расположении, указанном в параметре-Path. 1. Allows you to overwrite the backup that preexists in the location specified in the -Path parameter

Backup-CARoleService c:\adcsbackup1-Force Backup-CARoleService c:\adcsbackup1 -Force

-Добавочное -Incremental -Выполнить добавочное резервное копирование — Perform an incremental backup

Backup-CARoleService c:\adcsbackup7 — добавочный Backup-CARoleService c:\adcsbackup7 -Incremental

-Киплог -KeepLog 1. указывает команде на необходимость сохранения файлов журнала. 1. Instructs the command to keep log files. Если параметр не указан, файлы журнала усекаются по умолчанию, за исключением случая добавочного сценария. If the switch is not specified, log files are truncated by default except in the Incremental scenario

Backup-CARoleService c:\adcsbackup7 — Киплог Backup-CARoleService c:\adcsbackup7 -KeepLog

-Password -Password

Если используется параметр-Password, указанный пароль должен быть защищенной строкой. If the -Password parameter is used, the supplied password must be a secure string. Используйте командлет Read-Host для запуска интерактивного запроса на ввод безопасного пароля или используйте командлет ConvertTo-SecureString , чтобы указать пароль в строке. Use the Read-Host cmdlet to launch an interactive prompt for secure password entry, or use the ConvertTo-SecureString cmdlet to specify the password in-line.

Ознакомьтесь со следующими примерами. Review the following examples

Указание защищенной строки для параметра пароля с помощью командлета Read-Host Specifying a secure string for the Password parameter using Read-Host

Указание защищенной строки для параметра Password с помощью ConvertTo-SecureString Specifying a secure string for the Password parameter using ConvertTo-SecureString

Restore-CARoleService Restore-CARoleService

Командлет Адксадминистратион: Restore-Каролесервице ADCSAdministration Cmdlet: Restore-CARoleService

Аргументы — требуются аргументы полужирного шрифта Arguments — Bold arguments are required Описание Description
-Path -Path -Строка — расположение для восстановления резервной копии — String — location to restore backup from
— Это единственный безымянный параметр. — This is the only unnamed parameter
-Позиционированный параметр — positional parameter

Пример. Example:

Restore-Каролесервице.-path c:\adcsbackup1 — Force Restore-CARoleService.-Path c:\adcsbackup1 -Force

Restore-CARoleService c:\adcsbackup2-Force Restore-CARoleService c:\adcsbackup2 -Force

-Кэйонли -KeyOnly — Восстановить сертификат ЦС без базы данных; — Restore the CA certificate without the database
— Необходимо указать, если резервная копия была сделана с параметром-Кэйонли — Must be specified if the backup was taken with the -KeyOnly option

Пример. Example:

Restore-CARoleService c:\adcsbackup3-Кэйонли-Force Restore-CARoleService c:\adcsbackup3 -KeyOnly -Force

-Password -Password — Указывает пароль сертификатов ЦС и закрытых ключей. — Specifies the password of the CA certificates and private keys
— Должна быть защищенной строкой — Must be a secure string

Пример. Example:

Restore-CARoleService c:\adcsbackup4-Password (чтение-хост-запрос «пароль:»-AsSecureString)-Force Restore-CARoleService c:\adcsbackup4 -Password (read-host -prompt «Password:» -AsSecureString) -Force

Restore-CARoleService c:\adcsbackup5-Password (ConvertTo-SecureString «Pa55w0rd!» Restore-CARoleService c:\adcsbackup5 -Password (ConvertTo-SecureString «Pa55w0rd!» -AsPlainText-Force) — Force -AsPlainText -Force) -Force

-Датабасеонли -DatabaseOnly Восстановление базы данных без сертификата ЦС — Restore the database without the CA certificate

Restore-CARoleService c:\adcsbackup6 — Датабасеонли Restore-CARoleService c:\adcsbackup6 -DatabaseOnly

-Force -Force — Позволяет перезаписать существующие ключи — Allows you to overwrite the preexisting keys
— Необязательный параметр, но при восстановлении на месте, скорее всего, требуется — Is an optional parameter but when restoring in-place, it is likely required

Restore-CARoleService c:\adcsbackup1-Force Restore-CARoleService c:\adcsbackup1 -Force

Проблемы Issues

Резервная копия, не защищенная паролем, создается в случае сбоя функции ConvertTo-SecureString при использовании Backup-CARoleService с параметром-password. A non-password protected backup is taken if the ConvertTo-SecureString function fails while using the Backup-CARoleService with the -Password parameter.

Таблица SEQ таблица, \ * Арабская 18. распространенные ошибки Table SEQ Table \* ARABIC 18: Common Errors

Действие Action Ошибка Error Комментировать Comment
Restore-Каролесервице К:\адксбаккуп Restore-CARoleService C:\ADCSBackup Restore-CARoleService: процесс не может получить доступ к файлу, так как он используется другим процессом. Restore-CARoleService : The process cannot access the file because it is being used by another process. (Exception from HRESULT: (Exception from HRESULT:

0x80070020 0x80070020)

Прежде чем запускать командлет Restore-CARoleService, закройте Active Directory службы сертификатов. Stop the Active Directory Certificate Services service prior to running the Restore-CARoleService cmdlet
Restore-Каролесервице К:\адксбаккуп Restore-CARoleService C:\ADCSBackup Restore-CARoleService: Каталог не пуст. Restore-CARoleService : The directory is not empty. (Исключение из HRESULT: 0x80070091) (Exception from HRESULT: 0x80070091) Используйте параметр-Force для перезаписи существующих ключей Use the -Force parameter to overwrite preexisting keys
Backup-Каролесервице К:\адксбаккуп-пароль (чтение-хост-запрос «пароль:»-AsSecureString)-Датабасеонли Backup-CARoleService C:\ADCSBackup -Password (Read-Host -Prompt «Password:» -AsSecureString) -DatabaseOnly Backup-CARoleService: не удается разрешить набор параметров с использованием указанных именованных параметров. Backup-CARoleService : Parameter set cannot be resolved using the specified named parameters. Параметр-Password используется только для защиты паролем закрытых ключей и, следовательно, является недопустимым, если архивация не выполняется The -Password parameter is only used to password protect private keys and is therefore invalid when you are not backing them up
Restore-Каролесервице C:\ADCSBack15-Password (чтение-хост-запрос «пароль:»-AsSecureString)-Датабасеонли Restore-CARoleService C:\ADCSBack15 -Password (Read-Host -Prompt «Password:» -AsSecureString) -DatabaseOnly Restore-CARoleService: не удается разрешить набор параметров с использованием указанных именованных параметров. Restore-CARoleService : Parameter set cannot be resolved using the specified named parameters. Параметр-Password используется только для защиты паролем закрытых ключей и поэтому является недопустимым, если вы не восстанавливаете их. The -Password parameter is only used to password protect private keys and is therefore invalid when you are not restoring them
Restore-Каролесервице C:\ADCSBack14-Password (чтение-хост-запрос «пароль:»-AsSecureString) Restore-CARoleService C:\ADCSBack14 -Password (Read-Host -Prompt «Password:» -AsSecureString) Restore-CARoleService: системе не удается найти указанный файл. Restore-CARoleService : The system cannot find the file specified. (Исключение из HRESULT: 0x80070002) (Exception from HRESULT: 0x80070002) Указанный путь не содержит допустимой резервной копии базы данных. The path specified does not contain a valid database backup. Возможно, путь является недопустимым или резервная копия была сделана с параметром-Кэйсонли? Perhaps the path is invalid or the backup was taken with the -KeysOnly option?

Дополнительные ресурсы Additional Resources

Попробуйте сделать это: Создайте резервную копию центра сертификации в лаборатории с помощью Windows PowerShell Try This: Backup the CA in your lab using Windows PowerShell

Используйте команды на этом занятии, чтобы создать резервную копию базы данных ЦС и закрытого ключа, защищенных паролем. Use the commands in this lesson to backup the CA database and private key secured with a password.

Подождите, пока не будет восстановлен ЦС. Hold off on the restore of the CA at this time.

Читайте также:  F6flpy x64 windows 10
Оцените статью