Reply to Message

View discussion in a popup

Replying to:
online11
Contributor
Contributor

Add multiple disks on different datastores

Hi everyone, I am new to scripting. I am trying to script adding disks to different datastores on different hosts (not clustered). Lets say I have VMs called VM1 and VM2 I get this info from adddisk.txt file. I want to add disks to those VMs but I don't know the datastore name under specific host. If VM1 is under Host1, then datastore name is : Datastore1 IF VM2 is under Host2, then datastore name is : Datastore2 So how can I add disks to multiple VMs without knowing the datastore name? $servers = Get-Content "C:\Scripts\AddDisk\adddisk.txt" New-HardDisk -VM  $servers -CapacityGB  30 -DiskType Flat -Datastore "DatasoreName" -StorageFormat Thin Thanks in advance.

Reply
0 Kudos