Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Creating a Windows Agent Image

Updated on 2024-02-05 GMT+08:00

Preparing an ECS

Prepare an ECS that runs Windows Server 2019 Standard 64bit English and has a 40 GB system disk. Windows Server 2019 is used as an example, and you can select another version. Specify a valid password when creating the ECS and name the ECS SMS. The official Microsoft image is recommended.

Ensure that the ECS can access the Internet, so that the required tools can be downloaded.

Installing the Required Software

  1. Transfer the smsWindowesAgent folder created in Creating Scripts in Agent Images to the C:\directory of the ECS. The folder stores the agent image scripts you prepared.
  2. Install Python 3.7.6 to C:\smsWindowsAgent\Python. You can select another version as required.

  3. Run where python to check whether Python has been installed in the specified directory.

Installing requests and ConfigParser

Run the following commands on the ECS to install requests and ConfigParser.

pip install requests
pip install configparser

Modifying the ECS

  1. Enable scripts to automatically run upon ECS startup.

    1. Open the cmd and run gpedit. In the displayed window, choose Computer Configuration > Windows Settings > Scripts (Startup/Shutdown) > Startup.

    2. Click Add and specify C:\smsWindowesAgent\bin\Name of script for running Python.bat for Script Name.

  2. Install OpenSSH.

    1. Right-click the Start icon or press Win and X keys. In the displayed menu, choose Windows PowerShell (Administrator). In the displayed window, run the following command:
      Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
    2. After the installation is complete, restart the OS for the installation to take effect. Start the sshd and ssh-agent services and set them to automatically run at startup.

      Start sshd.

      Start-Service sshd

      Enable sshd to automatically run at startup.

      Set-Service sshd  Automatic

      Start ssh-agent.

      Start-Service ssh-agent

      Enable ssh-agent to automatically run at startup.

      Set-Service ssh-agent -StartupType Automatic
    3. Go to the C:\ProgramData directory and add the following content to the sshd_config file:

      PasswordAuthentication no

  3. Install OpenStack.

    Download the VMTools drivers required by SMS.

    Decompress the downloaded package, double-click the extracted file, and find the required drivers in ./vmtools-windows/upgrade/windows XX/drivers.

    Copy all driver files to the specified directory.

    Windows Server 2016_64bit is used here as an example.

    Copy all files in upgrade\windows 2016_64\drivers\viostor to C:\smsWindowsAgent\bin\peAgent\OpenStack\windows_device_driver\windows2016_64.

    Copy files in the rest of folders under upgrade\windows 2016_64\drivers to C:\smsWindowsAgent\bin\peAgent\OpenStack\windows_device_driver\windows2016_64.

    The picture below shows the files copied to the C:\smsWindowsAgent\bin\peAgent\OpenStack\windows_device_driver\windows2016_64 directory.

    Copy files required by other Windows versions to the corresponding directories.

  4. Open ports 8899 and 8900 on the ECS.

    netsh advfirewall firewall add rule name=peagent dir=in action=allow protocol=TCP localport=8899
    netsh advfirewall firewall add rule name=ntcldst dir=in action=allow protocol=TCP localport=8900

  5. (Optional) Install the password reset plug-in if you did no use a public image to create this ECS.

    1. Download the plug-in at https://cn-south-1-cloud-reset-pwd.obs.cn-south-1.myhuaweicloud.com/windows/reset_pwd_agent/CloudResetPwdAgent.zip.
    2. Double-click setup.bat in the CloudResetPwdAgent.Windows or CloudResetPwdUpdateAgent.Windows directory.
    3. In the Task Manager, search for cloudResetPwdAgent and cloudResetPwdUpdateAgent.
      • If they are there, the installation is successful.
      • If they are not there, the installation fails.

(Optional) Hardening Security

  1. Disable remote login.

    Open the Control Panel, choose System and Security > System > Allow remote access, and select Don't allow remote connections to this computer.

  2. Disable the WinRM service.

    1. Open the cmd or PowerShell as an administrator.
    2. Stop the WinRM service.

      net stop winrm

    3. Disable the WinRM service.

      sc config winrm start= disabled

  3. Set a password login policy to block brute-force attacks.

    1. Open the cmd or PowerShell as an administrator.
    2. Run the gpedit.msc command to start Local Group Policy Editor.
    3. In the displayed window, choose Computer Configuration > Windows settings > Security Settings > Account Policy > Account Lockout Policy. Set the account locking policy shown in the following figure. This policy indicates that if there are 6 consecutive unsuccessful login attempts, the account will be blocked for 3 minutes.

  4. Close listening ports in the Windows firewall.

    1. Open the cmd and run the netstat -ano command to check all listening ports.

    2. Close all dynamic ports (49152-65535) and port 135 used for listening.
      netsh advfirewall firewall add rule name=Tcp_disable dir=in action=block protocol=TCP localport=135,3389,5985,5986,49152-65535
    3. Close all UDP ports.
      netsh advfirewall firewall add rule name=Tcp_disable dir=in action=block protocol=UDP localport=any

Creating an Image

  1. Log in the IMS console.
  2. Click Create Image.

  3. Create a system disk image for the ECS as prompted.

  4. View the ID of the created image.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback