Export-CrescendoCommand
为 Crescendo 命令 对象创建 JSON 配置文件。
语法
Export-CrescendoCommand
[-command] <Command[]>
[-targetDirectory <String>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Export-CrescendoCommand
[-command] <Command[]>
-fileName <String>
[-Force]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
说明
此 cmdlet 为 Crescendo Command 对象创建 JSON 配置文件。 它可以为每个 命令 对象创建一个 JSON 文件,也可以创建一个包含传递给它的所有对象的 JSON 文件。
Crescendo Command 对象可以使用 New-CrescendoCommand
创建,也可以使用 Import-CommandConfiguration
从现有配置导入。
此 cmdlet 已添加到 Microsoft.PowerShell.Crescendo v1.1 中。
示例
示例 1 - 为每个命令创建单独的 JSON 文件
在此示例中,命令 对象从现有 JSON 配置文件导入。
Export-CrescendoCommand
用于为每个 cmdlet 创建单独的 JSON 文件。
$config = Import-CommandConfiguration C:\projects\vssadmin\vssadmin.crescendo.config.json
Export-CrescendoCommand -command $config -targetDirectory .
Get-ChildItem
Directory: D:\temp\Crescendo
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 12/13/2022 3:24 PM 869 Get-VssProvider.crescendo.json
-a--- 12/13/2022 3:24 PM 3483 Get-VssShadow.crescendo.json
-a--- 12/13/2022 3:24 PM 2474 Get-VssShadowStorage.crescendo.json
-a--- 12/13/2022 3:24 PM 863 Get-VssVolume.crescendo.json
-a--- 12/13/2022 3:24 PM 860 Get-VssWriter.crescendo.json
-a--- 12/13/2022 3:24 PM 4973 Resize-VssShadowStorage.crescendo.json
示例 2 - 为现有命令创建新的 JSON 配置文件
在此示例中,命令 对象从现有 JSON 配置文件导入。
Export-CrescendoCommand
用于创建新的 JSON 配置文件,其中包含所有命令。
$config = Import-CommandConfiguration C:\projects\vssadmin\vssadmin.crescendo.config.json
Export-CrescendoCommand -command $config -fileName VssAdmin.crescendo.json
Get-ChildItem
Directory: D:\temp\Crescendo
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 12/13/2022 3:10 PM 15313 VssAdmin.crescendo.json
新的 JSON 文件包含当前版本的 Crescendo 的新属性,并引用新的架构 URL。 这是将旧 JSON 配置文件转换为新格式的便捷方法。
参数
-command
要导出的一个或多个 Crescendo Command 对象。
类型: | Command[] |
Position: | 0 |
默认值: | None |
必需: | True |
接受管道输入: | True |
接受通配符: | False |
-Confirm
在运行 cmdlet 之前,提示你进行确认。
类型: | SwitchParameter |
别名: | cf |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-fileName
要创建的 JSON 文件的名称。
类型: | String |
Position: | Named |
默认值: | None |
必需: | True |
接受管道输入: | False |
接受通配符: | False |
-Force
覆盖现有文件。
类型: | SwitchParameter |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-targetDirectory
为每个 命令 对象创建的 JSON 文件的输出位置。
类型: | String |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-WhatIf
显示 cmdlet 运行时会发生什么情况。 该 cmdlet 未运行。
类型: | SwitchParameter |
别名: | wi |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
输入
Command[]