Hi all.
I've been strungling with this powershell script to create imagefile without success.
I've created VLT device without problem.
I don't know where to check anymore:
Here is my script:
param($addr="127.0.0.1", $port=3261, $user="root", $password="starwind",
$fileName="img1.img",
$starwindfiletype="img",
$filePath="My Computer\C\starwind",
$size=12,
$targetAlias="targetimg1",
$sectorSize=512,
$numaNode=0,
$cacheMode="wb",
$cacheSize=128)
Import-Module StarWindX
try
{
Enable-SWXLog
if($sectorSize -eq 4096 -and $size -lt 2)
{
throw "Minimal device size 2MB"
}
$server = New-SWServer -host $addr -port $port -user $user -password $password
$server.Connect()
Write-Host "Creating ImageFile" (just to understand where the script fail)
#create image file
New-ImageFile -server $server -path "My Computer\C\starwind" -fileName "img1.img" -size 2048
Write-Host "Creating ImageDevice" (just to understand where the script fail)
#create device
$device = Add-ImageDevice -server $server -path "My Computer\C\starwind" -fileName "img1.img" -sectorSize $sectorSize -NumaNode $numaNode -CacheMode $cacheMode -CacheSize $cacheSize
$device
Write-Host "Creating Target" (just to understand where the script fail)
#create target
$target = New-Target -server $server -alias $targetAlias -devices $device.Name
$target
}
catch
{
Write-Host $_ -foreground red
}
finally
{
$server.Disconnect()
}
The Latest Gartner® Magic Quadrant™Hyperconverged Infrastructure Software