Skip to content
INSIGHTS & GUIDES · NETCLOUD24

Using AppCmd as one part of an IIS recovery plan

Use named AppCmd backups for controlled IIS configuration rollback while protecting content, data, keys and runtimes separately, then verify application behaviour and global impact after a coordinated restore.

Read the article ↓
Editorial illustration: How to Back Up and Restore IIS Configuration with AppCmd

Platform: Windows Server 2019, 2022 and 2025, with the version and hosting restrictions described below.

Separate configuration rollback from application recovery

An AppCmd backup is a useful protection before changing IIS global configuration. It captures ApplicationHost.config and related server-level state so an unwanted setting change can be reversed. It does not capture every website file, database, certificate private key or application runtime. Calling it a complete web-server backup creates a recovery promise it cannot fulfil.

For managed Netcloud24 hosting, the operational team protects the full service and selects the appropriate recovery method. Customers should not need to choose between configuration-history files during an outage. This guide explains where AppCmd fits in that internal process and how an authorised administrator can verify a named backup before a controlled same-server restore.

Identify everything the proposed restore could affect

A global restore can revert unrelated sites, pools and bindings changed after the selected backup. Establish who else has modified the server and which applications share it. If only one property is wrong, a targeted correction may be safer and more precise than restoring the whole server configuration.

Review shared configuration, central deployment management and machine-specific encrypted settings. A local backup operation is not automatically a portable farm-migration package. If IIS reads configuration from a remote share, include that share, its protected keys and the supported recovery procedure in the plan. Reverting IIS cannot reverse a database schema change or restore a deleted upload.

Import-Module WebAdministration
Get-Website | Select-Object Name,Id,State,PhysicalPath,Bindings
Get-ChildItem IIS:\AppPools | Select-Object Name,State
Get-WebBinding
Get-Service WAS,W3SVC

Keep an inventory of content paths, deployment version, certificates and backend dependencies. Store it outside the web server too, so the record remains available when its operating-system volume is unavailable.

Create a named point that belongs to the actual change

Invoke AppCmd from an elevated session using its full Windows path. Include a purpose and timestamp in the name, then inspect the native exit code before another command overwrites it. Do not begin the planned change if the protection step failed.

$iisCommand = Join-Path $env:windir 'System32\inetsrv\appcmd.exe'
$configPoint = 'CHG-Example-Identity-' + (Get-Date -Format 'yyyyMMdd-HHmmss')
& $iisCommand add backup $configPoint
if ($LASTEXITCODE -ne 0) { throw 'Configuration backup did not complete.' }
& $iisCommand list backups

The new named BACKUP object should appear in the list. This shows it is discoverable, not that application data was included. If creation fails, preserve output and inspect permissions, storage and configuration validity. Relying on an assumed automatic history copy is not equivalent to confirming the named baseline associated with this change.

Inspect the artifact and protect its confidentiality

The normal local backup directory is beneath Windows System32\inetsrvackup, with a folder for the chosen name. Confirm the expected files exist and record their size and time. A hash can detect an unexpected change during handling, but it does not establish logical correctness or portability to another server.

$pointDirectory = Join-Path $env:windir ('System32\inetsrv\backup\' + $configPoint)
Get-ChildItem -LiteralPath $pointDirectory
Get-Item (Join-Path $pointDirectory 'applicationHost.config') |
  Select-Object FullName,Length,LastWriteTime
Get-FileHash (Join-Path $pointDirectory 'applicationHost.config')

Treat the files as sensitive configuration. They may disclose account names, service paths and connection information even where particular secret fields are encrypted. Copy or protect them through the approved off-server process with restricted access. A backup kept only on the same failed disk cannot support a disk-loss recovery.

Protect the dependencies through their own supported methods

Back up site content and distributed web.config files using the application or deployment process. Include uploaded data and external file locations. Use application-aware protection for databases rather than copying their live files into a web-content archive. Record which application release matches which data state.

Protect HTTPS certificates and private keys through the approved certificate process, with separately managed recovery secrets. Retain bindings and thumbprints so recovery associates the right key. Include runtime, hosting bundle and module versions, scheduled tasks and custom service dependencies.

IIS credential encryption can depend on machine-specific keys. Copying ApplicationHost.config to a replacement host may therefore leave protected identities unusable. Use the documented migration or shared-configuration key procedure rather than decrypting secrets into a public file. Same-server rollback and rebuilding elsewhere are distinct recovery objectives.

Select a restore point with the application owner

Inspect the available backups and choose the point whose configuration is actually wanted. Before restoring, save the current state under another name so investigation and potential reversal remain possible. Arrange the interruption: AppCmd restore is a global IIS operation and can stop or disrupt service, not an invisible per-site update.

& $iisCommand list backups
& $iisCommand add backup ('Before-Recovery-' + (Get-Date -Format 'yyyyMMdd-HHmmss'))
$approvedPoint = 'REPLACE_WITH_REVIEWED_EXISTING_BACKUP_NAME'
& $iisCommand restore backup $approvedPoint
if ($LASTEXITCODE -ne 0) { throw 'Restore failed; preserve its output before further changes.' }

Do not select solely by age. A newer point might contain the fault, while an older one can remove legitimate work on another site. Document approval for the global scope and keep the exact command result. If a management platform owns configuration, coordinate its desired state so it does not immediately reapply the unwanted change.

Validate service behaviour after configuration returns

Inspect services, site states, pools and bindings. Start only components the recorded baseline says should run. Check certificate associations as well as IIS binding entries, since a configuration can reference a key no longer present on the server.

Get-Service WAS,W3SVC
Get-Website | Select-Object Name,State,PhysicalPath,Bindings
Get-WebAppPoolState -Name 'ServiceDesk-Worker'
netsh http show sslcert
Invoke-WebRequest 'https://servicedesk.corp.example/' -UseBasicParsing

Test static and dynamic paths, authentication, writes and backend operations appropriate to the application. Check neighbouring sites too. An AppCmd success message establishes that configuration was restored, not that every referenced folder, runtime or data state still exists. Record the application owner’s acceptance and any remaining dependency issue separately.

Learn from failures without overwriting the evidence

A failed restore needs its exact error, backup content, current configuration and shared-configuration state preserved. Inspect permissions and protected dependencies before manually replacing files. Repeated global restores or uncontrolled XML edits can erase the best explanation of the incident and revert another administrator’s repair.

Retain named points according to policy and protect a known recovery set off-server. Rehearse the complete recovery on an isolated representative system rather than claiming that listing a backup proves disaster recovery. The service team’s durable result is a documented route from configuration fault to verified application recovery, with clear limits on what AppCmd supplies.

Further reading


Was this answer helpful?

« Back
Contact

Write to us

Do you have questions about our services or need a quote? Write to us and we will respond as soon as possible.

Contact form

Fields marked * are required.