header1   header
header
header Register : : Login header
header
connector   connector
menuleft menuright
submenu   submenu
left
catching return code of a command with "invoke-command" ?
Last Post 30 Jul 2009 10:11 PM by Buddhika. 0 Replies.
Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
BuddhikaUser is Offline
New Member
New Member
Posts:2
Avatar

--
30 Jul 2009 10:11 PM
    Hi,
    I am using "invoke-command" to execute a script on a remote machine.

    invoke-command -computername -scriptblock {command to execute the script}

    My script returns "-1" when there are any errors.
    So, I wanted to ensure that script has executed successfully by checking the return code.

    I tried as follows.
    $code = invoke-command -computername ....

    But it returns nothing.
    Doesn't "Invoke-command" catch return code of script block?
    Is there other way to resolve this?

    Any help will be highly appreciated.

    Thanks in advance
    Buddhika
    You are not authorized to post a reply.


    Active Forums 4.3
    right
    footer   footer
    footer Sponsored by Quest Software • SAPIEN Technologies • Compellent • Microsoft Windows Server 2008 R2 footer
    footer   footer