本文說明如何連線至 Windows Special Administrative Console (SAC)。SAC 會使用序列埠連線至 Windows 虛擬機器 (VM) 執行個體,且不依賴網路連線,因此有助於排解 Windows VM 執行個體的問題或進行復原。連線至 VM 的序列埠主控台並使用 SAC,即可中斷 VM 的開機程序,或存取 CMD 或 PowerShell 終端機進行疑難排解。如要使用遠端桌面進行一般用途 (而非疑難排解),請使用 RDP 連線至 Windows VM。
事前準備
- 如要使用互動式序列主控台連線至 VM 的 SAC,請先啟用 VM 的互動存取權。詳情請參閱「啟用對序列主控台的互動式存取權」。
-
如果尚未設定驗證,請先完成設定。
「驗證」是指驗證身分的程序,確認您有權存取 Google Cloud 服務和 API。如要從本機開發環境執行程式碼或範例,請選取下列其中一個選項,向 Compute Engine 進行驗證:
Select the tab for how you plan to use the samples on this page:
Console
When you use the Google Cloud console to access Google Cloud services and APIs, you don't need to set up authentication.
gcloud
-
After installing the Google Cloud CLI, initialize it by running the following command:
gcloud init
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
- Set a default region and zone.
前往 Google Cloud 控制台的「VM instances」(VM 執行個體) 頁面。
按一下要連線的 VM 名稱。
按一下「Connect to serial console」(連線至序列主控台),開啟互動式控制台。
PROJECT_ID
:含有 VM 的專案 IDZONE
:VM 所在的可用區名稱VM_NAME
:VM 名稱輸入
cmd
,然後按下 Enter 鍵。您會看見以下輸出內容:SAC>cmd The Command Prompt session was successfully launched. SAC> EVENT: A new channel has been created. Use "ch -?" for channel help. Channel: Cmd0001 SAC>
使用
ch -sn CHANNEL_NAME
指令,然後按一下 Enter 鍵。ch -sn CHANNEL_NAME
將
CHANNEL_NAME
替換成您在上一個步驟中建立的管道名稱。輸出結果會與下列內容相似:
Name: Cmd0001 Description: Command Type: VT-UTF8 Channel GUID: 28de7392-5413-11ea-bb03-c9656a2ed613 Application Type GUID: 63d02271-8aa4-11d5-bccf-00b0d014a2d0 Press <esc><tab> for next channel. Press <esc><tab>0 to return to the SAC channel. Use any other key to view this channel.
按下空格鍵,然後使用系統上註冊的本機憑證登入。
Please enter login credentials. Username: USERNAME Domain: DOMAIN (leave blank if no domain) Password: PASSWORD
連線後,您就能存取命令提示字元殼層。
Microsoft Windows [Version 10.0.14393] (c) 2016 Microsoft Corporation. All rights reserved. C:\Windows\system32>
選用:如要輸入 Powershell 提示,請輸入
powershell.exe
,然後按 Enter 鍵。- 瞭解如何使用 RDP 連線至 Windows VM
- 瞭解如何排解互動式序列主控台問題 。
連線至序列主控台
如要使用互動式序列主控台連線至您的 Windows 執行個體,請按照下列分頁中的步驟進行。
主控台
互動式序列主控台隨即開啟,看到以下輸出內容時,即可開始使用:
Computer is booting, SAC started and initialized. Use the "ch -?" command for information about using channels. Use the "?" command for general help. SAC>
如果互動式序列主控台是空白畫面,且游標閃爍,可能是因為緊急管理服務已關閉。如要瞭解如何解決這個問題,請參閱互動式序列主控台疑難排解。
gcloud
使用
gcloud compute connect-to-serial-port
指令連線至已啟用序列埠存取的 VM 執行個體:gcloud compute connect-to-serial-port VM_NAME \ --port=2 \ --zone=ZONE \ --project=PROJECT_ID
更改下列內容:
互動式序列主控台隨即開啟,看到下列輸出內容時,即可開始使用:
Computer is booting, SAC started and initialized. Use the "ch -?" command for information about using channels. Use the "?" command for general help. SAC>
如果互動式序列主控台是空白畫面,且游標閃爍,可能是因為緊急管理服務已關閉。如要瞭解如何解決這個問題,請參閱互動式序列主控台疑難排解。
如要瞭解如何使用互動式序列主控台,請參閱 Microsoft SAC 指令說明文件。
在 Windows SAC 中開啟命令提示字元
如要在 SAC 中開啟命令提示字元,請按照下列步驟操作:
後續步驟
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-10 (世界標準時間)。
-