本文档介绍如何连接到 Windows Special Administrative Console (SAC)。SAC 使用到 Windows 虚拟机实例的串行端口连接,并且不依赖于网络连接,这有助于对 Windows 虚拟机实例进行问题排查或恢复。通过连接到虚拟机的串行控制台并使用 SAC,您可以中断虚拟机的启动过程,或者访问 CMD 或 PowerShell 终端以执行问题排查。如需获得除问题排查之外的通用远程桌面体验,请使用 RDP 连接到 Windows 虚拟机。
准备工作
- 您必须先为虚拟机启用交互式访问权限,然后才能使用交互式串行控制台连接到虚拟机的 SAC。如需了解详情,请参阅启用对串行控制台的交互式访问。
- 
  
  如果您尚未设置身份验证,请进行设置。身份验证用于验证您的身份,以便访问 Google Cloud 服务和 API。如需从本地开发环境运行代码或示例,您可以通过选择以下选项之一向 Compute Engine 进行身份验证:
  
   
   
     
   
  
   
   
     
   
  
   
   
     
   
  
 
 
 
  
    
      Select the tab for how you plan to use the samples on this page: ConsoleWhen you use the Google Cloud console to access Google Cloud services and APIs, you don't need to set up authentication. gcloud- 
 
 
  
  
   
   
  
   
   
  
   
   
     
   
  
  
   
   
  
   
   
  
   
   
  
 
 
   
   
      安装 Google Cloud CLI。 安装完成后,运行以下命令来初始化 Google Cloud CLI: gcloud init如果您使用的是外部身份提供方 (IdP),则必须先使用联合身份登录 gcloud CLI。 
- Set a default region and zone.
 连接到串行控制台如需使用交互式串行控制台连接到 Windows 实例,请完成以下任一标签页中的步骤: 控制台- 在 Google Cloud 控制台中,前往虚拟机实例页面。 
- 点击要连接到的虚拟机的名称。 
- 点击连接到串行控制台以打开交互式控制台。 
 系统会打开交互式串行控制台。当您看到以下输出时,则表明可以开始使用: 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命令连接到启用串行端口访问权限的虚拟机实例:gcloud compute connect-to-serial-port VM_NAME \ --port=2 \ --zone=ZONE \ --project=PROJECT_ID替换以下内容: - PROJECT_ID:包含虚拟机的项目 ID。
- ZONE:虚拟机所在区域的名称
- VM_NAME:虚拟机的名称
 系统会打开交互式串行控制台。当您看到以下输出时,即可使用: 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 中打开命令提示符,请执行以下操作: - 输入 - 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 - 连接后,即可使用命令提示符 shell。 - Microsoft Windows [Version 10.0.14393] (c) 2016 Microsoft Corporation. All rights reserved. C:\Windows\system32> 
- 可选:如需进入 Powershell 提示符,请输入 - powershell.exe,然后按 Enter 键。
 后续步骤- 了解如何使用 RDP 连接到 Windows 虚拟机
- 了解如何排查交互式串行控制台问题。
 如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。 最后更新时间 (UTC):2025-10-29。 -