Exception calling "Open" with "0" argument(s): "Cannot open database "hmaildb" requested by the login. The login failed. Login failed for user 'ladadbm'." At D:\Media\hmail_final_1782889374.ps1:3 char:1 + $conn.Open() + ~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : SqlException Exception calling "ExecuteReader" with "0" argument(s): "ExecuteReader requires an open and available Connection. The connection's current state is closed." At D:\Media\hmail_final_1782889374.ps1:6 char:1 + $rd=$cmd.ExecuteReader() + ~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : InvalidOperationException You cannot call a method on a null-valued expression. At D:\Media\hmail_final_1782889374.ps1:8 char:7 + while($rd.Read()){$cnt++;Write-Output $rd[0]} + ~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : InvokeMethodOnNull You cannot call a method on a null-valued expression. At D:\Media\hmail_final_1782889374.ps1:9 char:1 + $rd.Close() + ~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : InvokeMethodOnNull Total tables: 0 Exception calling "ExecuteReader" with "0" argument(s): "ExecuteReader requires an open and available Connection. The connection's current state is closed." At D:\Media\hmail_final_1782889374.ps1:12 char:1 + $rd=$cmd.ExecuteReader() + ~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : InvalidOperationException You cannot call a method on a null-valued expression. At D:\Media\hmail_final_1782889374.ps1:14 char:7 + while($rd.Read()){$cols+=$rd[0]} + ~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : InvokeMethodOnNull You cannot call a method on a null-valued expression. At D:\Media\hmail_final_1782889374.ps1:15 char:1 + $rd.Close() + ~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : InvokeMethodOnNull hm_accounts: Exception calling "ExecuteReader" with "0" argument(s): "ExecuteReader requires an open and available Connection. The connection's current state is closed." At D:\Media\hmail_final_1782889374.ps1:18 char:1 + $rd=$cmd.ExecuteReader() + ~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : InvalidOperationException You cannot call a method on a null-valued expression. At D:\Media\hmail_final_1782889374.ps1:19 char:7 + while($rd.Read()){$row="";for($i=0;$i -lt $rd.FieldCount;$i++){if($i ... + ~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : InvokeMethodOnNull You cannot call a method on a null-valued expression. At D:\Media\hmail_final_1782889374.ps1:20 char:1 + $rd.Close() + ~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : InvokeMethodOnNull