Export-CrescendoCommand
建立 Crescendo Command 物件的 JSON 組態檔。
語法
Export-CrescendoCommand
[-command] <Command[]>
[-targetDirectory <String>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Export-CrescendoCommand
[-command] <Command[]>
-fileName <String>
[-Force]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
此 Cmdlet 會為 Crescendo Command 物件建立 JSON 組態檔。 它可以為每個命令 命令 物件建立一個 JSON 檔案,或建立一個 JSON 檔案,其中包含傳遞給它的所有物件。
Crescendo Command 物件可以使用 New-CrescendoCommand
建立,或使用 Import-CommandConfiguration
從現有的組態匯入。
此 Cmdlet 已在 Microsoft.PowerShell.Crescendo v1.1 中新增。
範例
範例 1 - 為每個命令建立個別的 JSON 檔案
在此範例中,Command 物件會從現有的 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 組態檔
在此範例中,Command 物件會從現有的 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
針對每個 Command 物件所建立之 JSON 檔案的輸出位置。
類型: | String |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-WhatIf
顯示 Cmdlet 執行時會發生什麼事。 Cmdlet 未執行。
類型: | SwitchParameter |
別名: | wi |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
輸入
Command[]