Web Deploy delete Operation
Applies To: Windows 7, Windows Server 2003, Windows Server 2003 R2, Windows Server 2008, Windows Server 2008 R2, Windows Vista, Windows XP
delete
The delete operation deletes the objects specified by the destination argument.
Example
msdeploy -verb:delete -dest:apphostconfig="MySite/OldApp1"
The delete operation deletes the object or objects specified by the -dest argument. The -dest argument is required. The -source argument can be specified but is not necessary. If you specify the -source argument, you must also specify the same settings for the -dest argument, or use -dest:auto.
Tip
You specify the object or objects to be deleted by using a Web Deploy provider. For more about providers, see Web Deploy Providers.
Certain providers are blocked for use with the delete verb because the results could be harmful or catastrophic. For more information, see the "Providers That Are Blocked or Unsupported in Delete Operations" section later in this topic.
If you delete a Web site or application, the directory (that is, physical path) that contains the content files for the site or application will be deleted, including all files in the content directory. If you are unsure about which objects will be deleted, use the -whatif operation setting with the command first to see what the outcome of the operation will be.
Warning
If you have two or more Web sites that point to the same content path and you delete one of the sites, the content for the all sites that point to the same content path will also be deleted without warning. Before you run a command that uses a delete operation, it is strongly recommended that you run the command with the –whatif operation setting so that you can examine the potential results.
Providers That Are Supported in Delete Operations
The following table lists the providers that are supported for use with delete and the resulting action when each provider is so used.
Provider | Result when used with delete | ||
---|---|---|---|
AppHostConfig |
Deletes the specified Web site or Web application, including any virtual directories and their content. Example: |
||
appPoolConfig |
Deletes the specified application pool. Example:
|
||
cert |
Deletes the certificate for the specified certificate hash from the certificate store when the certificate is not referred to by a link extension. For more information about link extensions, see Web Deploy Link Extensions. Example: |
||
contentPath |
Deletes the content for the specified directory, file, site, or application path. Example: Warning Sites or applications that are defined on the specified content path will become unavailable without warning.
|
||
createApp |
Converts the specified application into a folder. The folder and its contents remain intact. Example: |
||
dirpath |
Deletes the specified directory and its contents. The dirpath provider takes an argument that is the full path of a file system directory (for example, c:\inetpub\wwwroot\dir1). UNC paths and mapped network drives are supported. Environment variables like %windir% are supported, but wildcard characters are not. If the path contains spaces, the path must be enclosed in double quotation marks. Example: Warning If the specified directory is not empty, no warning will be given before it is deleted.
|
||
filePath |
Deletes the specified file. The filePath provider takes the full path of a single file (for example, c:\msdeploy\destinationfolder\file2.txt). UNC paths and mapped network drives are supported. Environment variables like %windir% are supported, but wildcard characters are not. If the path contains spaces, the path must be enclosed in double quotation marks. Example: Warning If the file is read only or hidden, it will be deleted without warning.
|
||
iisApp |
Deletes the specified Web application and its content folders. Folders that were marked as virtual directories will not be deleted and their content will remain intact. Example: |
Providers That Are Blocked or Unsupported in Delete Operations
To avoid potentially harmful results, the following providers are blocked or unsupported for use with the delete operation.
Provider | Status |
---|---|
appHostSchema |
Blocked |
archiveDir |
Blocked |
comObject32 |
Blocked |
comObject64 |
Unsupported |
dbFullSQL |
Blocked |
dbMySQL |
Blocked |
fcgiExtConfig |
Unsupported |
gacAssembly |
Unsupported |
machineConfig32 |
Blocked |
machineConfig64 |
Blocked |
metaKey |
Unsupported |
package |
Unsupported when the package contains unsupported providers. If the object of a delete operation is a package that contains providers that are not supported by the delete operation, the operation will fail. |
recycleApp |
Blocked |
regKey |
Unsupported |
regValue |
Unsupported |
rootWebConfig32 |
Blocked |
rootWebConfig64 |
Blocked |
runCommand |
Unsupported |
setAcl |
Unsupported |
urlScanConfig |
Unsupported |
WebServer |
Blocked |
WebServer60 |
Blocked |
These providers are blocked from use with delete by the BlockHarmfulDeleteOperations and the BlockUnsupportedDeleteOperations rules. For more information, see Web Deploy Rules.
Notes
The CertificateExtension and HttpCertConfigExtension link extensions are blocked from use with the delete operation. For more information about link extensions, see Web Deploy Link Extensions. The auto provider will be blocked when no source is specified (for example, msdeploy.exe -verb:delete -dest:auto
). The manifest provider deletes all objects specified by the manifest when all providers in the manifest support delete. Otherwise, the execution of the manifest will stop on the first command in the manifest that contains a blocked provider.
Example Usages
1) Delete the application “OldApp1” from the MySite Web site, including all related content files and configuration.
msdeploy -verb:delete -dest:apphostconfig="MySite/OldApp1"
2) Delete the application “OldApp2” from the MySite Web site, including all related content files and configuration.
msdeploy -verb:delete -source:apphostconfig="MySite/OldApp2" -dest:auto
3) Delete the file Doc.txt from the root directory of drive D.
msdeploy -verb:delete -dest:filepath=d:\Doc.txt
4) Delete the App4 application from the Site1 Web site by using the iisApp provider.
msdeploy -verb:delete -dest:iisapp="Site1/App4"
5) Revert the App1 application to a folder. The folder and its contents remain intact.
msdeploy -verb:delete -dest:createapp=Site1/App1