【发布时间】:2017-08-09 09:14:47
【问题描述】:
我开始自学 PowerShell。在其中一本书(Windows Server 2012 R2,实施和维护)中,我得到了必须创建脚本的任务,该脚本在运行后将创建存储池、虚拟磁盘和新创建的虚拟磁盘上的新共享。
根据书上的说明,这是我已经做过的:
New-StoragePool -FriendlyName "Pool" -StorageSubSystemFriendlyName (Get-StorageSubSystem).FriendlyName -PhysicalDisk (Get-PhysicalDisk | where CanPool -eq True) -ProvisingTypeDefault Thin -ResiliencySettingNameDefault Mirror
New-VirtualDisk -FriendlyName "vDisk1" -StoragePoolFriendlyName "Pool" -Size 5TB
New-VirtualDisk -FriendlyName "vDisk2" -StoragePoolFriendlyName "Pool" -Size 10TB
New Partition -DiskNumber(Get-Disk | where BusType -eq Spaces).Number -UseMaximumSize -AssignDriveLetter | Format-Volume -FileSystem NTFS -Confirm:$false
现在我想通过New-Item 函数为新创建的虚拟磁盘创建共享文件夹。问题是我不确定如何为多个磁盘创建路径,更重要的是New Partition 中的参数-AssignDriveLetter 会自动创建驱动器号。因此,我不知道驱动器号。结果我不知道如何在New-Item中设置变量Path。
【问题讨论】:
-
这是为 Hyper-V 准备的?
-
嗨,是的,服务器在 Hyper-V 上
-
在 hyper vi 上设置 2 个物理磁盘(离线)
标签: powershell windows-server-2012-r2 hyper-v