Issue creating New-StoragePool and New-VirtualDisk specifying 1 physical Disk
hi all,
i'm having issues with script i'm building, want create 1 storagepool with 1 physical drive 2 available disks, then create virtualdisk , volume with 1 disk in storagepool, initialize disk, format volume - the run same remaining disk
so far can script building storagepool both available disks get-physical -canpool $true can't specify 1 disk -friendlyname
below script -canpool $true works
$drivelogs = "sqldblogs" $physicaldisks = get-storagesubsystem -friendlyname "storage spaces*" | get-physicaldisk -canpool $true new-storagepool -friendlyname $drivelogs -storagesubsystemfriendlyname "storage spaces*" -physicaldisks $physicaldisks | new-virtualdisk -friendlyname $drivelogs -provisioningtype fixed -usemaximumsize | initialize-disk -passthru |new-partition -driveletter e -usemaximumsize | format-volume get-volume -driveletter e | set-volume -newfilesystemlabel sqldblogs
specifying 1 disk 2 available (which i'm trying achieve) with the below script -friendlyname gets error msg
$drivelogs = "sqldblogs" $drivedata = "sqldbdata" #$physicaldisks = get-storagesubsystem -friendlyname "storage spaces*" | get-physicaldisk -canpool $true #$physicaldisks = get-physicaldisk -friendlyname "physicaldisk2" $physicaldisks = get-storagesubsystem -friendlyname "storage spaces*" | get-physicaldisk -friendlyname "physicaldesk2" new-storagepool -friendlyname $drivelogs -storagesubsystemfriendlyname "storage spaces*" -physicaldisk $physicaldisks | new-virtualdisk -friendlyname $drivelogs -provisioningtype fixed -usemaximumsize | initialize-disk -passthru |new-partition -driveletter e -usemaximumsize | format-volume get-volume -driveletter e | set-volume -newfilesystemlabel sqldblogs*
error msg
get-physicaldisk : input object cannot bound parameters command either because command does
not take pipeline input or input , properties not match of parameters take pipeline input.
@ c:\users\amolina\documents\storageconfig_test_physicaldisk.ps1:5 char:73
+ ... me "storage spaces*" | get-physicaldisk -friendlyname "physicaldesk2"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ categoryinfo : invalidargument: (msft_storagesub...crosoft/win...):psobject) [get-physicaldisk], parame
terbindingexception
+ fullyqualifiederrorid : inputobjectnotbound,get-physicaldisk
new-storagepool : cannot validate argument on parameter 'physicaldisks'. argument null or empty. provide an
argument not null or empty, , try command again.
@ c:\users\amolina\documents\storageconfig_test_physicaldisk.ps1:6 char:104
+ ... ubsystemfriendlyname "storage spaces*" -physicaldisk $physicaldisks |
+ ~~~~~~~~~~~~~~
+ categoryinfo : invaliddata: (:) [new-storagepool], parameterbindingvalidationexception
+ fullyqualifiederrorid : parameterargumentvalidationerror,new-storagepool
get-volume : no msft_volume objects found property 'driveletter' equal 'e'. verify value of property
, retry.
@ c:\users\amolina\documents\storageconfig_test_physicaldisk.ps1:10 char:1
+ get-volume -driveletter e | set-volume -newfilesystemlabel sqldblogs*
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
+ categoryinfo : objectnotfound: (e:char) [get-volume], cimjobexception
+ fullyqualifiederrorid : cmdletizationquery_notfound_driveletter,get-volume
if run below script i error there's no available disks in storage spool create virtual disk, though create storagpool 1 disk of 2 available , can create virtual disk manually i'm not sure why it's not working.
$drivelogs = "sqldblogs" $drivedata = "sqldbdata" #$physicaldisks = get-storagesubsystem -friendlyname "storage spaces*" | get-physicaldisk -canpool $true $physicaldisks = get-physicaldisk -friendlyname "physicaldisk2" #$physicaldisks = get-storagesubsystem -friendlyname "storage spaces*" | get-physicaldisk -friendlyname "physicaldesk2" new-storagepool -friendlyname $drivelogs -storagesubsystemfriendlyname "storage spaces*" -physicaldisk $physicaldisks | new-virtualdisk -friendlyname $drivelogs -provisioningtype fixed -usemaximumsize | initialize-disk -passthru |new-partition -driveletter e -usemaximumsize | format-volume get-volume -driveletter e | set-volume -newfilesystemlabel sqldblogs*
i've started powershell appreciated, if there's whole new way i'm learning.
background info, i'm trying automate provisioning of vm's (as possible) have create 50 vm's dev, uat , prod environments , need them identical
cheers!!
got working..
basically had add -resiliencysettingname parameter otherwise the script doesn't work , error
"there not enough eligible physical disks in storage pool create specified virtual disk configuration"
below working script
#create storagepools new-storagepool –friendlyname $drivelogs –storagesubsystemfriendlyname “storage spaces*” –physicaldisks (get-physicaldisk physicaldisk2) new-storagepool –friendlyname $drivedata –storagesubsystemfriendlyname “storage spaces*” –physicaldisks (get-physicaldisk physicaldisk3) #build virtual disk, volume , format e: (sqldblogs) new-virtualdisk -storagepoolfriendlyname $drivelogs -friendlyname $drivelogs -provisioningtype fixed -resiliencysettingname simple -usemaximumsize | initialize-disk -passthru |new-partition -driveletter e -usemaximumsize | format-volume get-volume -driveletter e | set-volume -newfilesystemlabel $drivelogs #build virtual disk, volume , format f: (sqldbdata) new-virtualdisk -storagepoolfriendlyname $drivedata -friendlyname $drivedata -provisioningtype fixed -resiliencysettingname simple -usemaximumsize | initialize-disk -passthru |new-partition -driveletter f -usemaximumsize | format-volume get-volume -driveletter f | set-volume -newfilesystemlabel $drivedata
Windows Server > Windows PowerShell
Comments
Post a Comment