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
Situation Awareness
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

Initializing Windows Data Disks Using a Script

Updated on 2024-09-06 GMT+08:00

Scenarios

This section uses Windows Server 2008 R2 Enterprise 64bit to describe how to automatically initialize data disks attached to a server running Windows.

The formatting procedure varies depending on the server OS. This section is for reference only.

NOTICE:

When using a disk for the first time, if you have not initialized it, including creating partitions and file systems, the additional space added to this disk in an expansion later may not be normally used.

Prerequisites

  • You have attached a data disk to a server but not initialized the disk.
  • You have logged in to the server.

Notes and Constraints

  • This script uses the NTFS file system and MBR partition style by default.
  • This script does not support the initialization of disks that form Windows logical volume groups.
  • This script supports the initialization of up to 23 Windows data disks.
  • Only data disks in Windows simplified Chinese and English can be initialized.

Manually Executing the Script to Initialize Windows Data Disks

  1. Log in to the server, visit https://ecs-instance-driver.obs.cn-north-1.myhuaweicloud.com/datadisk/WinVMDataDiskAutoInitialize.ps1 to obtain the automatic disk initialization script, and save it to C:\Windows\System32.
  2. On the server desktop, click Start, right-click Windows PowerShell, and choose Run as administrator from the shortcut menu.

    Figure 1 Run Windows PowerShell as administrator

  3. In the displayed dialog box, run the following command to set the script execution policy:

    Set-ExecutionPolicy -ExecutionPolicy Bypass -Force

  4. Run the following command in the dialog box to execute the initialization script:

    C:\Windows\System32\WinVMDataDiskAutoInitialize.ps1

    Information similar to the following is displayed:

    NOTE:

    If the command output shows that PowerShell cannot load the file, the reason is that the Windows system policy does not allow the PowerShell script downloaded from the network to be executed when the script is not signed.

    To solve this problem, run the set-ExecutionPolicy RemoteSigned command and restart PowerShell.

  5. (Optional) On the Disk Management page, view the initialization result.

    Figure 2 Disk Management

Configuring Automatic Initialization of Windows Data Disks

You can configure automatic initialization for Windows data disks. After the configuration is complete, new disks purchased and attached to this server will be automatically initialized after the server is logged in to again.

NOTE:

To enable automatic initialization of Windows data disks on multiple servers, configure automatic initialization on one server, create a private image for this server, and use the image to batch create servers.

  1. On the server desktop, click Start, right-click Computer in the list, and choose Manage from the shortcut menu.

    The Server Manager window is displayed.

  2. In the navigation tree on the left, choose Configuration > Task Scheduler > Task Scheduler Library, then right-click and choose Create Task from the shortcut menu.

    The Create Task page is displayed.

  3. On the displayed page, click the General tab, enter WinVMDataDiskInitialize in the Name text box, and click Change User or Group.

    The Select User or Group page is displayed.

  4. Click Advanced in the lower left corner of the page.
  5. Click Find Now to the right of the page. In the search result list, select SYSTEM and click OK.

    The Select User or Group page is displayed.

  6. Click OK.

  7. Click the Triggers tab and click Create in the lower left corner of the page.
  8. On the New Trigger page, choose At log on for Begin the task, retain the default settings for other parameters, and click OK.

  9. Click the Actions tab and click Create in the lower left corner of the page.
  10. On the Edit Action page, set the following parameters:

    • Action: Choose Start a program.
    • Program/Script: Select powershell.exe.
    • Add arguments (optional): Enter -ExecutionPolicy Bypass C:\Windows\System32\WinVMDataDiskAutoInitialize.ps1.

    Click OK.

  11. On the Create Task page, click OK.

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