Register
: :
Login
Home
News
Forums
Scripts
User Groups
Resources
About
Forums
Search
Members
Unanswered
Active Topics
Forums
>
Looking Ahead
>
Developing for PowerShell v2.0
catching return code of a command with "invoke-command" ?
Last Post 30 Jul 2009 10:11 PM by
Buddhika
. 0 Replies.
Sort:
Oldest First
Most Recent First
Prev
Next
You are not authorized to post a reply.
Author
Messages
Buddhika
New Member
Posts:2
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.
Using PowerShell
--General PowerShell
--Active Directory
--Exchange Server
--SharePoint
--SQL Server
--System Center
--Non-Microsoft Products
--Books, Tools, and Videos
--Working with .NET
--Peer Review
--Testing, Testing...
PowerShell Development
--Cmdlet Development
--PSDrive Provider Development
--Hosting the Shell
Looking Ahead
--Using PowerShell v2.0
--Developing for PowerShell v2.0
PowerShellCommunity.org
--Community Announcements and Assistance
--Completely Unrelated
--User Groups
--Community Business
----Suggestion Box
Forums
>
Looking Ahead
>
Developing for PowerShell v2.0
Active Forums 4.3
Sponsored by Quest Software • SAPIEN Technologies • Compellent • Microsoft Windows Server 2008 R2