sql - Unable to use SQLPS CmdLet Backup-SQLDatabase with -InputObject parameter -
having run same timeout issue found here , trying workaround, i'm finding error:
backup-sqldatabase : cannot bind parameter 'inputobject'. cannot convert "[instdw_qa0]" value of type "microsoft.sqlserver.management.smo.server" type "microsoft.sqlserver.management.smo.server". @ line:21 char:50 + backup-sqldatabase -database msdb -inputobject $server -backupaction database ... + ~~~~~~~ + categoryinfo : invalidargument: (:) [backup-sqldatabase], parameterbindingexception + fullyqualifiederrorid : cannotconvertargumentnomessage,microsoft.sqlserver.management.powershell.backupsqldatabasecommand
when running simple script:
$servername = "instdw_qa0" $server = new-object ("microsoft.sqlserver.management.smo.server") $servername $server.connectioncontext.statementtimeout = 0 $db = $server.databases["msdb"] backup-sqldatabase -database msdb -inputobject $server -backupaction database -compressionoption on -copyonly -initialize
this occurs on 3 win7 machines i've tried on, script runs fine on servers (win2012) i've tried on. 3 win7 machines have mix of installed software. 1 has sql 2008r2, 2012 , 2014 installed, had 2008r2 , 2012. 1 had ps 2.0 installed, 2 others had ps 3.0. servers again mix. have ps 3.0 installed, have sql2008r2 , sql2012, have sql2012 , 1 tried on had sql2014, worked. consistent difference os, win7 vs win2012, doesn't make lot of sense me potential cause.
the error confusing, 2 types references identical. i've tried loading specific smo assembly versions (11 , 12) prior running script , doesn't seem help.
any ideas? in advance.
offhand, i'd guess objects might being created using different versions of same library backup-sqldatabase uses, , that's why servers complain , others work fine.
since you're using method workaround timeout issue of backup-sqldatabase
, may useful know the same issue fixed restore-sqldatabase
in cumulative update package 8 sql server 2012 sp1. think affect backup-sqldatabase
. might work around timeout issue if can't fix error you're getting backup-sqldatabase
.
Comments
Post a Comment