Ok , seems that it can't see the drive letter.

Seems to be something within this part I think - the drive letter part is wrong (if I change it to $DriveDefinition[1] it bombs out.

; split string on commas
$DriveDefinition = Split($DriveDefinition, ',')
; assign array elements to working vars
$DriveLetter = $DriveDefinition[0]
$Share = $DriveDefinition[0]