修改套件發行者指令碼Modify package publisher script

MSIX 工具組中的「修改封裝發行者」腳本可用來更新資訊清單中的「發行者」,然後再根據新的憑證重新簽署封裝。The Modify package publisher script in the MSIX Toolkit can be used to update the publisher in the manifest before re-signing the package based on a new certificate. 此腳本目前僅限於 MSIX 應用程式,而非 MSIX 套件組合。This script is currently limited to MSIX apps, and not MSIX bundles.

語法Syntax

.\modify-package-publisher.ps1 -directory <String> -redist <String> -certPath <String> [[-pfxPath] <String>] [[-Password] <String>] [[-forceContinue]<Switch>]

範例Examples

根據憑證更新發行者Update the publisher based on the certificate

PS C:\> .\modify-package-publisher.ps1 -directory "C:\MSIX" -redist "C:\MSIX-Toolkit\Redist" -certPath "C:\cert\mycert.cer"

此命令會以遞迴方式搜尋所有 MSIX 套件的 C:\MSIX 內容,並更新 MSIX 應用程式發行者以符合位於 C:\cert\mycert.cer. 的憑證發行者This command recursively searches the contents of C:\MSIX for all MSIX packages and updates the MSIX app publisher to match the publisher of the certificate located at C:\cert\mycert.cer. 不支援使用 SHA1 憑證簽署 MSIX 套件格式應用程式。Signing an MSIX package format application with a SHA1 certificate is unsupported.

更新發行者並簽署 MSIX 應用程式Update the publisher and sign the MSIX app

PS C:\> .\modify-package-publisher.ps1 -directory "C:\MSIX" -redist "C:\MSIX-Toolkit\Redist" -certPath "C:\cert\mycert.cer" -pfxPath "C:\cert\CertKey.pfx"

此命令會以遞迴方式搜尋所有 MSIX 套件的 C:\MSIX 內容,並更新 MSIX 應用程式發行者以符合位於 C:\cert\mycert.cer. 的憑證發行者This command recursively searches the contents of C:\MSIX for all MSIX packages and updates the MSIX app publisher to match the publisher of the certificate located at C:\cert\mycert.cer. 然後,命令會使用位於 C:\cert\CertKey.pfx. 的憑證重新簽署已識別的 MSIX 套件Then, the command re-signs the identified MSIX packages using the certificate located at C:\cert\CertKey.pfx. 不支援使用 SHA1 憑證簽署 MSIX 套件格式應用程式。Signing the MSIX package format application with a SHA1 certificate is unsupported.

更新發行者,並使用受密碼保護的 PFX 憑證來簽署 MSIX 應用程式Update the publisher and sign the MSIX app with a password-protected PFX certificate

PS C:\> .\modify-package-publisher.ps1 -directory "C:\MSIX" -redist "C:\MSIX-Toolkit\Redist" -certPath "C:\cert\mycert.cer" -pfxPath "C:\cert\CertKey.pfx" -password "aaabbbccc"

此命令會以遞迴方式搜尋所有 MSIX 套件的 C:\MSIX 內容,並更新 MSIX 應用程式發行者以符合位於 C:\cert\mycert.cer. 的憑證發行者This command recursively searches the contents of C:\MSIX for all MSIX packages and updates the MSIX app publisher to match the publisher of the certificate located at C:\cert\mycert.cer. 然後,命令會使用位於 C:\cert\CertKey.pfx 的憑證重新簽署已識別的 MSIX 套件,並使用密碼aaabbbccc來解除鎖定受密碼保護的憑證。Then, the command re-signs the identified MSIX packages using the certificate located at C:\cert\CertKey.pfx using the password aaabbbccc to unlock the password protected certificate. 不支援使用 SHA1 憑證簽署 MSIX 套件格式應用程式。Signing the MSIX package format application with a SHA1 certificate is unsupported.

更新發行者、簽署 MSIX 應用程式,並強制繼續進行下一個 MSIX 應用程式Update the publisher, sign the MSIX app, and force continue to next MSIX app

PS C:\> .\modify-package-publisher.ps1 -directory "C:\MSIX" -redist "C:\MSIX-Toolkit\Redist" -certPath "C:\cert\mycert.cer" -pfxPath "C:\cert\CertKey.pfx" -forceContinue -pfxPath "C:\cert\CertKey.pfx"

此命令會以遞迴方式搜尋所有 MSIX 套件的 C:\MSIX 內容,並更新 MSIX 應用程式發行者以符合位於 C:\cert\mycert.cer. 的憑證發行者This command recursively searches the contents of C:\MSIX for all MSIX packages and updates the MSIX app publisher to match the publisher of the certificate located at C:\cert\mycert.cer. 然後,命令會使用位於 C:\cert\CertKey.pfx. 的憑證重新簽署已識別的 MSIX 套件Then, the command re-signs the identified MSIX packages using the certificate located at C:\cert\CertKey.pfx. 如果在處理 MSIX 封裝時發生任何錯誤,腳本會繼續更新發行者,並重新簽署已識別的 MSIX 套件。If any errors occur while processing an MSIX package, the script will continue to update the publisher and re-sign the identified MSIX packages. 不支援使用 SHA1 憑證簽署 MSIX 套件格式應用程式。Signing the MSIX package format application with a SHA1 certificate is unsupported.

參數Parameters

-目錄-directory

提供包含 MSIX 應用程式的根目錄。Provides the root directory which contains MSIX applications. 此目錄會以遞迴方式搜尋所有 MSIX 的封裝。This directory is recursively searched for all MSIX packages.

  • 類型: 字串Type: String
  • 必要: 是的Required: Yes
  • 位置: 署名Position: Named
  • 預設值:Default value: None

-certPath-certPath

提供憑證檔案(* .cer)的完整路徑,用來識別新的或更新的應用程式發行者資訊。Provides the full path to the certificate file (*.cer) used to identify the new or updated app publisher information.

  • 類型: 字串Type: String
  • 必要: 是的Required: Yes
  • 位置: 署名Position: Named
  • 預設值:Default value: None

-可轉散發套件-redist

MSIX 工具組內抓取之可轉散發檔案的路徑。The path to the redistributable file retrieved from within the MSIX Toolkit. 此檔案是用來將應用程式重新封裝為 MSIX 套件格式。This file is used to re-package the app into the MSIX package format. 必須指向32位或64位架構可轉散發套件。Must point to either the 32-bit or 64-bit architecture redistributable.

  • 類型: 字串Type: String
  • 必要: 是的Required: Yes
  • 位置: 署名Position: Named
  • 預設值:Default value: None

-pfxPath-pfxPath

在更新應用程式發行者之後,將用來簽署 MSIX 套件的程式碼簽署憑證(* .pfx)路徑。The path to the code signing certificate (*.pfx) which will be used to sign the MSIX package after updating the app publisher.

  • 類型: 字串Type: String
  • 必要:Required: No
  • 位置: 署名Position: Named
  • 預設值:Default value: None

-password-password

程式碼簽署憑證(* .pfx)所需的密碼。The password required by the code signing certificate (*.pfx).

  • 類型: 字串Type: String
  • 必要:Required: No
  • 位置: 署名Position: Named
  • 預設值:Default value: None

-forceContinue-forceContinue

若已指定,腳本會忽略錯誤,並嘗試更新所有應用程式的發行者資訊。If specified, the script will ignore errors and attempt to update the publisher information of all apps.

  • 類型: 字串Type: String
  • 必要:Required: No
  • 位置: 署名Position: Named
  • 預設值:Default value: None