Register
: :
Login
Home
News
Forums
Scripts
User Groups
Resources
About
Forums
Search
Members
Unanswered
Active Topics
Forums
>
Using PowerShell
>
Working with .NET
Retrieving PowerShell errors
Last Post 26 Jan 2010 02:58 PM by
Swackhammer1
. 0 Replies.
Sort:
Oldest First
Most Recent First
Prev
Next
You are not authorized to post a reply.
Author
Messages
Swackhammer1
New Member
Posts:1
26 Jan 2010 02:58 PM
Hi, I need to be able to retrieve the error variable from a powershell cmd in .NET. Given below is some code: RunspaceInvoke myRunSpaceInvoke = new RunspaceInvoke(thisRunspace); string command = "Get-MailContact -Identity " + alias + " -DomainController " + domainController + " -ErrorVariable Err -ErrorAction SilentlyContinue"; results = myRunSpaceInvoke.Invoke(command).ToString(); I want 'results' to equal 'Err'. Any help would be appreciated. Thanks,
You are not authorized to post a reply.
Using PowerShell
--General PowerShell
--Books, Tools, and Videos
--Exchange Server
--Active Directory
--System Center Family
--Non-Microsoft Products
--SharePoint
--SQL Server
--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
>
Using PowerShell
>
Working with .NET
Active Forums 4.3
Sponsored by Quest Software • SAPIEN Technologies • Compellent • Microsoft Windows Server 2008 R2