How to capture error/warning/success from powershell in c#?


hi,

i'm writing small tool collect detail office 365 using powershell in c#.

challenge i'm facing is, after powershell command run, want know whether successful or not. if not , warning or error.

"if  errors.count > 0" me understand failed , "if  errors.count == 0" tell me there issue.

the concern is, need clear error, before running every command to use above logic find success or failure of recent command, there other better method do have? if , can please share it.

secondly how find/capture warning?

thank in advance.

hi,

how running these powershell commands c# code?

can post example?


marcus björklund

in order others find relevant information, please mark/propose answers and/or vote posts helpful, appropriate.



Visual Studio Languages  ,  .NET Framework  >  Visual C#



Comments

Popular posts from this blog

Azure DocumentDB Owner resource does not exist

job syspolicy_purge_history job fail in sqlserver 2008

Trying to register with public marketplace error with 'Get-AzureStackStampInformation'