gpt4 book ai didi

powershell - 为什么在Microsoft 2016免费软件实例上看不到C:\ProgramData\Amazon文件夹?我需要运行脚本以将其他卷附加到该实例

转载 作者:行者123 更新时间:2023-12-02 23:40:36 25 4
gpt4 key购买 nike

我在AWS(免费套餐)上创建了Windows 2016实例类型。我创建了一个“冷硬盘”卷,并通过管理控制台将其附加到Windows 2016实例。到现在为止还挺好。

获得管理员密码后,我可以将RDP导入实例。但是,当我登录Windows 2016实例时,看不到所附的“冷硬盘”卷。

因此,我在实例上启动了“磁盘管理”并启用了新卷。

我搜索了一下,才知道我们需要运行一个powershell脚本来在实例开始时启用所有附加的卷。

脚本是:

<powershell>
C:\ProgramData\Amazon\EC2-Windows\Launch\Scripts\InitializeDisks.ps1
</powershell>

但是我在Windows 2016实例的C驱动器上根本找不到C:\ ProgramData \ Amazon文件夹。
我不知道该怎么办。

https://aws.amazon.com/premiumsupport/knowledge-center/secondary-volumes-windows-server-2016/

最佳答案

InitializeDisks.ps1脚本是EC2Launch的一部分。

To accommodate the change from .NET Framework to .NET Core, the EC2Config service has been deprecated on Windows Server 2016 AMIs and replaced by EC2Launch. EC2Launch is a bundle of Windows PowerShell scripts that perform many of the tasks performed by the EC2Config service.



默认情况下,应将其安装在Windows 2016 AMI上,但请注意C:\ ProgramData \ Amazon目录是隐藏的。

如果由于某种原因未安装它,则应该可以按照以下说明手动安装它:

To download and install the latest version of EC2Launch

  1. If you have already installed and configured EC2Launch on an instance, make a backup of the EC2Launch configuration file. The installation process does not preserve changes in this file. By default, the file is located in the following directory: C:\ProgramData\Amazon\EC2-Windows\Launch\Config.

  2. Download EC2Launch.zip from the following location to a directory on the instance:

https://s3.amazonaws.com/ec2-downloads-windows/EC2Launch/latest/EC2-Windows-Launch.zip

  1. Download the Install.ps1 PowerShell script from the following location to the same directory where you downloaded EC2Launch.zip:

https://s3.amazonaws.com/ec2-downloads-windows/EC2Launch/latest/install.ps1

  1. Run Install.ps1

  2. Replace your backup of the EC2Launch configuration file in the C:\ProgramData\Amazon\EC2-Windows\Launch\Config directory.



资料来源: http://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ec2launch.html

作为测试,我刚刚部署了Windows 2016 Base AMI模板,并可以确认C:\ ProgramData \ Amazon确实存在(ProgramData是隐藏目录,因此请转到“ View ”>“显示隐藏文件”进行查看)。

我还在启动时向实例添加了Cold Storage HDD和(如您所述)以下用户数据(在“配置实例详细信息”页面的“高级详细信息”部分下):
<powershell>
C:\ProgramData\Amazon\EC2-Windows\Launch\Scripts\InitializeDisks.ps1
</powershell>

并可以确认在启动VM时,正确/自动初始化了Cold HDD,并将其作为D:\驱动器使用。

如果您在首次启动实例时未添加所需的用户数据,则可以在以后通过选择实例并转到操作>实例设置>查看/更改用户数据来添加它。

关于powershell - 为什么在Microsoft 2016免费软件实例上看不到C:\ProgramData\Amazon文件夹?我需要运行脚本以将其他卷附加到该实例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43882263/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com