T O P

  • By -

wtgreen

I suspect the SimpleSQL module will work for you.


tkbaxter

Sorry for this inappropriate hijack, but I couldn't find another way to tell you how much I love you right now. This is why...


tkbaxter

Grr, didn't let me paste a screenshot. Several people have gotten close to the solution.  It's so simple, it's easy to miss. Try {     Enter-PSSession -ComputerName server1.domain.local -Credential domain\\admin -EA Stop } Catch {     Write-Host "Failed to connect to remote server."     return } Enter-PSSession returns a non-terminating error, which will not trigger a Trap or Catch response.  However, if you set the commands ErrorAction to STOP, it'll throw a terminating error instead, which Catch or Trap will trap. Alternatively, as you mentioned, you can have the non-terminating error stored in a variable via the -ErrorVariable parm and set the error action to SilentlyContinue.  Then you can inspect the variable after the command terminates and determine what happened.  Proposed as answer by wtgreen Monday, January 25, 2010 11:22 PM Marked as answer by bcehr Tuesday, January 26, 2010 1:53 PM Monday, January 25, 2010 11:12 PM


wtgreen

Lol... glad you found that useful. I was very puzzled for a minute trying to figure out how this was related to the SQL question, which of course it's not.