Add-VirtualTape gives error

StarWind VTL, VTL Free, VTL Appliance
Post Reply
mete
Posts: 18
Joined: Thu Oct 23, 2025 4:23 pm

Fri Oct 24, 2025 6:52 am

$tape = Add-VirtualTape -VTLDevice $device -tapeType $device.DriveType -tapeSize $size -maxDataFileSize $maxDataFileSize
results
Error:
200 Failed: invalid parameter value..
$device is correct and valid, DriveType is 8, $size is 0 and $maxDataFileSize is 0. What is the invalid parameter value ?
yaroslav (staff)
Staff
Posts: 4309
Joined: Mon Nov 18, 2019 11:11 am

Fri Oct 24, 2025 7:07 am

Please share full script.
mete
Posts: 18
Joined: Thu Oct 23, 2025 4:23 pm

Fri Oct 24, 2025 7:53 am

Code: Select all

param($addr="127.0.0.1", $port=3261, $user="root", $password="starwind",
	$libraryName='vtl',
	#[parameter(Mandatory=$true)]$barCode,
	$size=0, # tape size in megabytes. If this parameter is equal 0, maximum supported size by specified tape type will be used
	$maxDataFileSize=0) # part size in megabytes. Tape data files will be split into parts. If this parameter is equal 0, the tape will not split.

Import-Module StarWindX

try
{
	Enable-SWXLog
	$server = New-SWServer -host $addr -port $port -user $user -password $password
	$server.Connect()
	$device = Get-Device $server -name $libraryName
	if( !$device )
	{
		throw "library not found"
	}

	$device
	$tape = Add-VirtualTape -VTLDevice $device -tapeType $device.DriveType -tapeSize $size -maxDataFileSize $maxDataFileSize
	$tape
	
	#$params = new-object -ComObject StarWindX.Parameters
	#if ($barcode)
	#{	
	#	$params.AppendParam("barCode", $barCode)
	#}
	#$tape = $device.CreateTape($device.DriveType, $size, $maxDataFileSize, $params)
}
catch
{
	Write-Host $_ -foreground red
}
finally
{
	$server.Disconnect()
}
outputs

Code: Select all

.\createTape.ps1


Name                   : vtl
DeviceType             : VTL
DeviceId               : 0x0000022DAAC57480
File                   :
TargetName             : iqn.2008-08.com.starwindsoftware:vtl-target
TargetId               : 0x0000022DAA1D6F80
Size                   : 0
CacheMode              : empty
CacheSize              : empty
CacheBlockExpiryPeriod : empty
Exists                 : True
DeviceLUN              : 0
IsSnapshotsSupported   : False
Snapshots              :
SectorSize             :
State                  : 0
Parent                 :
Tapes                  : System.__ComObject
AvailableSlots         : 96
TransportSlots         : 1
DriveSlots             : 4
ImportExportSlots      : 3
StorageSlots           : 96
Slots                  : System.__ComObject
ReplicationSettings    : System.__ComObject
DriveType              : 8

Error:
200 Failed: invalid parameter value..
yaroslav (staff)
Staff
Posts: 4309
Joined: Mon Nov 18, 2019 11:11 am

Fri Oct 24, 2025 11:06 am

Thanks for your update. Please try
1. Custom size.
2. Different Libraryname value (It might be also good to see /headers / or StarWind.cfg)
mete
Posts: 18
Joined: Thu Oct 23, 2025 4:23 pm

Fri Oct 24, 2025 12:30 pm

size=102400, libraryName=myvtl also gives the same error.
mete
Posts: 18
Joined: Thu Oct 23, 2025 4:23 pm

Fri Oct 24, 2025 1:18 pm

I believe I found the problem, it is because the folder for the tapes (given to Add-VirtualTapeLibrary -path) did not exist.
yaroslav (staff)
Staff
Posts: 4309
Joined: Mon Nov 18, 2019 11:11 am

Fri Oct 24, 2025 1:30 pm

Good point!
Post Reply