9 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
1
vote
0
answers
43
views
Why doesn't the error stream from a runspace created with $Host appear in the console? [duplicate]
Consider the following PowerShell which writes to each of the (non-output) streams in the current runspace, then does the same in another runspace created with $Host:
$sb = {
$DebugPreference = '...
1
vote
1
answer
84
views
Management automation host rectangle: bottom cannot be greater than or equal to top
I'm getting an error saying bottom cannot be greater than or equal to top.
I'm using the Rectangle constructor documented here: https://learn.microsoft.com/en-us/dotnet/api/system.management....
1
vote
1
answer
177
views
Rendering Powershell Output with Complex Commands
I'm trying to execute a PS1 file via a C# application and capture/segment the output based on severity. Error, Debug, Info, etc. This is a Windows Form application. Here's the Run Method, which I ...
1
vote
0
answers
443
views
PSHost PromptForChoice format ChoiceDescription
In my PSCmdlet class I'm asking the user to make a choice with PromptForChoice. The user is prompted to select the connectionstring he wants to use. I can't manage to give the ChoiceDescriptions the ...
0
votes
1
answer
667
views
Custom PSHost, Get-Credential cmdlet in C#
i am trying to implement a custom PSHost class for the purpose of crafting GUIs for Power Shell scripts.
I have taken the code here as a base and started adapting it for GUI Projects
https://msdn....
5
votes
1
answer
2k
views
How to capture a Powershell CmdLet's Object output when the CmdLet is programmatically Invoked from C#
Background
PowerShell 3 with SDK
C# with Framework 4.5
Implementation
I have implemented my own PSHost alogn with PSHostUserInterface.
In PSHostUserInterface I override all Write... methods and ...
2
votes
3
answers
10k
views
how to establish and enter a remote session using runspace in powershell
I am trying to establish a session with a remote host B from my machine A, within a C# code. I am using runspace API for that. the code snippet is provided below
Runspace runspace = ...
6
votes
3
answers
7k
views
How to extract $lastexitcode from c# powershell script execution
I've got a scipt executing in C# using the powershell async execution code on code project here:
http://www.codeproject.com/KB/threads/AsyncPowerShell.aspx?display=PrintAll&fid=407636&df=90&...
1
vote
2
answers
753
views
Powershell Sqlcmd popup in c#
I have a PSHost object executing a Powershell script myscript.ps1 and that .ps1 script is executing sqlcmd.exe to get what it needs done. Is there a way to keep it from popping up empty sqlcmd dos ...