powershell - How can I see variable values within an inlinescript script block executed within an Azure runbook? -
this has obvious if forgive me. have dug through posts, articles, etc better part of day , hoping can shed light this.
the problem dataset fill failing within inlinescript script block. have been looking see how view contents of $connectionstring, $query, , $cmd variables within inlinescript script block. have defined connection string , query variable. can a $conn.open() , doesn't fail. have passed connection , query variables sqlcommand object:
$cmd = new-object system.data.sqlclient.sqlcommand($query, $conn)
i create dataset , dataadaptor objects:
$ds = new-object system.data.dataset $da = new-object system.data.sqlclient.sqldataadapter($cmd)
when executing following:
try { [void]$da.fill($ds) } catch { write-error "not able fill dataset list of customers!" }
the catch/error branch taken.
my belief there no results being returned $cmd empty resulting in fill error. being in runbook none of commands send output console valid. being able capture contents of $connectionstring, $query, , $cmd variables huge.
btw, code within $query executes expected within ssms.
without try-catch statement, error appears:
categoryinfo : notspecified: (:) [], methodinvocationexception + fullyqualifiederrorid : invalidoperationexception cannot call method on null-valued expression.
Comments
Post a Comment