Author Posts

September 26, 2017 at 2:51 pm

I need to run this command in powershell and I've tried numerous different ways. I believe PS has an issue with the quotes although it doesn't throw an error.

snapdrive7.0.exe /s /v"/qn SILENT_MODE=1 /Li SDInstall.log LPSM_SERIALNUMBER=serialnumber INSTALLDIR=\"c:\Program Files\NetApp\SnapDrive\" SVCUSERNAME=domain\username SVCUSERPASSWORD=password SVCCONFIRMUSERPASSWORD=password" SDW_WEBSRV_TCP_PORT=808 SDW_WEBSRV_HTTP_PORT=4098 TRANSPORT_PRT_SELECTION=2 TRANSPORT_PRT_PORT=80 TRANSPORT_PROTOCOL_LOGON_USERNAME=username TRANSPORT_PROTOCOL_LOGON_PASSWORD=password ESXIPADDRESS=IPaddress ESXUSERNAME=username ESXUSERPASSWORD=password ESXCONFIRMUSERPASSWORD=password ADD_WINDOWS_FIREWALL=1"

September 26, 2017 at 3:49 pm



$SvcCred        = Get-SBCredential -UserName 'domain\username' # This function is in SB-Tools module, if you're using PS 5 use: Install-Module SB-Tools -Force 
#$SvcCred        = Get-Credential -UserName 'domain\username' # Alternatively use the native Get-Credential but you'll need to interactively enter the pwd every time..
$TransportCred  = Get-SBCredential -UserName 'TransportProtocolUserName' # Same thing..
$EsxCred        = Get-SBCredential -UserName 'EsxUserName' 


$myArguments  = ' /s /v"/qn '
$myArguments += 'SILENT_MODE=1 '
$myArguments += '/Li SDInstall.log '
$myArguments += 'LPSM_SERIALNUMBER=1111222233334 '
$myArguments += 'INSTALLDIR=''c:\Program Files\NetApp\SnapDrive\'' '
$myArguments += "SVCUSERNAME=$($SvcCred.UserName) "
$myArguments += "SVCUSERPASSWORD=$($SvcCred.GetNetworkCredential().Password) " 
$myArguments += "SVCCONFIRMUSERPASSWORD=$($SvcCred.GetNetworkCredential().Password) " 
$myArguments += 'SDW_WEBSRV_TCP_PORT=808 '
$myArguments += 'SDW_WEBSRV_HTTP_PORT=4098 '
$myArguments += 'TRANSPORT_PRT_SELECTION=2 '
$myArguments += 'TRANSPORT_PRT_PORT=80 '
$myArguments += "TRANSPORT_PROTOCOL_LOGON_USERNAME=$($TransportCred.UserName) "
$myArguments += "TRANSPORT_PROTOCOL_LOGON_PASSWORD=$($TransportCred.GetNetworkCredential().Password) "
$myArguments += 'ESXIPADDRESS=IPaddress '
$myArguments += "ESXUSERNAME=$($EsxCred.UserName) "
$myArguments += "ESXUSERPASSWORD=$($EsxCred.GetNetworkCredential().Password) "
$myArguments += "ESXCONFIRMUSERPASSWORD=$($EsxCred.GetNetworkCredential().Password) "
$myArguments += 'ADD_WINDOWS_FIREWALL=1"'

& "snapdrive7.0.exe $myArguments"

September 26, 2017 at 6:55 pm

Would $myArguments be better set as an array ?

$SnapDrive = "snapdrive7.0.exe"

$myArguments = @()
$myArguments += ' /s /v"/qn '
$myArguments += 'SILENT_MODE=1 '
$myArguments += '/Li SDInstall.log '
$myArguments += 'LPSM_SERIALNUMBER=1111222233334 '
$myArguments += 'INSTALLDIR="c:\Program Files\NetApp\SnapDrive\" '
$myArguments += "SVCUSERNAME=$($SvcCred.UserName) "
$myArguments += "SVCUSERPASSWORD=$($SvcCred.GetNetworkCredential().Password) "
$myArguments += "SVCCONFIRMUSERPASSWORD=$($SvcCred.GetNetworkCredential().Password) "
$myArguments += 'SDW_WEBSRV_TCP_PORT=808 '
$myArguments += 'SDW_WEBSRV_HTTP_PORT=4098 '
$myArguments += 'TRANSPORT_PRT_SELECTION=2 '
$myArguments += 'TRANSPORT_PRT_PORT=80 '
$myArguments += "TRANSPORT_PROTOCOL_LOGON_USERNAME=$($TransportCred.UserName) "
$myArguments += "TRANSPORT_PROTOCOL_LOGON_PASSWORD=$($TransportCred.GetNetworkCredential().Password) "
$myArguments += 'ESXIPADDRESS=IPaddress '
$myArguments += "ESXUSERNAME=$($EsxCred.UserName) "
$myArguments += "ESXUSERPASSWORD=$($EsxCred.GetNetworkCredential().Password) "
$myArguments += "ESXCONFIRMUSERPASSWORD=$($EsxCred.GetNetworkCredential().Password) "
$myArguments += 'ADD_WINDOWS_FIREWALL=1"'

&$SnapDrive $myArguments

You may have to run each of those as a seperate parameter though.

$SnapDrive = "snapdrive7.0.exe"

$myArguments = ' /s /v"/qn '
$myArguments1 = 'SILENT_MODE=1 '
$myArguments2 = '/Li SDInstall.log '
$myArguments3 = 'LPSM_SERIALNUMBER=1111222233334 '
etc
etc

$SnapDrive $myArguments $myArguments1 $myArguments2 $myArguments3...........