共用方式為


Web Deploy regKey Provider

Applies To: Windows 7, Windows Server 2003, Windows Server 2003 R2, Windows Server 2008, Windows Server 2008 R2, Windows Vista, Windows XP

regKey

The regKey provider synchronizes registry keys between a source computer and a destination computer.

Example

msdeploy -verb:sync -source:regKey=HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Inetmgr -dest:auto,computerName=Max -xml

The regKey provider can be used to return registry content from a source computer, or to move registry content from a source computer to a destination computer. Specify the source and destination by using the -source and -destination arguments. The provider takes an argument that specifies a registry key (for example, HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Inetmgr). If the registry path you specify contains spaces, you must enclose the path in double quotation marks. The abbreviations HKCR, HKCU, HKLM, HKU, and HKCC can be substituted for HKEY_CLASSES_ROOT, HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE, HKEY_USERS, and HKEY_CURRENT_CONFIG, respectively.

A dump operation returns the path of the specified registry node and the paths to all subnodes. If the -xml operation setting is specified, all the registry key values under the specified node will also be returned as attributes in the XML markup. If the -xml operation setting is not specified, only the registry paths will be returned. The registry output of a dump operation will not necessarily appear in sorted order. If you want to ensure that the output will be sorted, you can use a command-line pipe with the sort command, as in the following example:

msdeploy -verb:dump -source:regkey="hkey_current_user\control panel\desktop\windowmetrics" | sort

In a sync operation, all registry keys and registry values under the specified node are included. If the registry path exists on the destination server, all keys and values under the registry path on the destination server will be updated.

Warning

ACLs for registry keys and values are preserved in a synchronization operation, but certain paths in the registry can require administrator permissions. The provider will fail if it does not have the necessary permissions to access the registry keys that you specify.

Example usages

1) Return the contents of the Inetmgr registry key in XML format.

msdeploy -verb:dump -source:regKey=HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Inetmgr -xml

2) Synchronize the contents of the Inetmgr registry key in XML format with the archive located in the c:\archive directory.

msdeploy -verb:sync -source:regKey=HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Inetmgr -dest:archiveDir=c:\archive -xml

3) Do not delete registry keys on the destination that do not exist in the source package.

msdeploy -verb:sync -source:package=C:\package.zip -dest:webServer,computerName=DestServer -skip:skipAction=Delete,objectName=regKey