Questions tagged [runspace]

In the context of using PowerShell commands with managed code a runspace is the operating environment for the commands invoked by the host application.

This environment includes the commands and data that are currently present, and any language restrictions that currently apply.Host applications can use the default runspace that is provided by Windows PowerShell, or they can create their own runspaces by using the RunspaceFactory class. By using that class, The host application can create individual runspaces or they can create a pool of runspaces. Once a runspace is created and opened, the host application can invoke commands synchronously or asynchronously by using a PowerShell object. For more information see Writing a Windows PowerShell Host Application

283 questions
0
votes
1 answer

adding Powershell Modules into Runspace asp.net

Hi can someone point out were i'm going wrong with my code I receive errors like below upon invoking The Windows PowerShell snap-in 'Microsoft.Exchange.Management.PowerShell.Admin' is not installed on this machine. he term 'MailboxReport' is not…
user3569698
0
votes
1 answer

Unable to Search Event Log with Runspaces in Powershell

I am searching a list of computers event logs for a specific event. This list is 7,000+ systems. I would love to have this utilize runspaces. I have the following code, yet it does not work. It looks like the return is null and of course causes the…
Louis M.
  • 3
  • 2
0
votes
1 answer

How I can update the Field extensionAttribute3 with Powershell and System.Management.Automation in ASP.NET`?

net application and I want to update informations in the active directory. For this I use the System.Management.Automation namespace. With this I can use the Powershell for this. It works good but I don't know how I can update the field…
Tarasov
  • 3,625
  • 19
  • 68
  • 128
0
votes
2 answers

Open Remote Runspace by providing web proxy server's ip address and port

I am writing a .Net component in C# that needs to open a Remote Powershell connection for Exchange online to execute cmdlets. However there is a web proxy server that sits between local machine and internet. I have not provided proxy server settings…
Gags
  • 827
  • 2
  • 13
  • 29
0
votes
2 answers

How do I add multiple email addresses?

Below is the code i'm using. I'm unable to add multiple addresses using the powershell Emailaddresses parameter. The code works fine if I just put in one email address, but once I add two addresses in the code below it returns exception stating…
0
votes
0 answers

Call external functions from multiple PowerShell scripts in C#

I have a C# application that runs PowerShell scripts after reading them off database as strings. Assume script1, script2 and utilityfunctions are scripts read from database. var rs = RunspaceFactory.CreateRunspace(); rs.Open(); var ps =…
Kenpachii
  • 145
  • 1
  • 13
0
votes
1 answer

Pass collection of C# Psobjects to powershell pipeline

I have a collection of C# PSObjects that i want to pass to a powershell script. I like to pass it in the pipeline so i can use it in the process section of the psfile. Anyone have any clue if this is possible or not and in that case. How do i do…
Borderman
  • 21
  • 3
0
votes
1 answer

Why isn't Powershell clearing?

So, I'm having an issue getting my function to produce it's own data after the second time I run it. The first time I produce the GetUsers command, provided my username and password is right, it'll return an arraylist with my users. If I run it…
Jack M
  • 81
  • 6
-1
votes
1 answer

C# Execute PowerShell Commands and Scripts using existing Powershell instance

I have written an PowerShell CmdLet with C#. Within this class I want to be able to execute other PowerShell Scripts in the same instance. I've tried different ways, but nothing is working.... Thank you ... [Cmdlet(VerbsCommon.Show,…
Enrico
  • 19
  • 3
-1
votes
1 answer

powershell runspace: access to global variable Yes , or no?

I have this module that I import on the local system. When I run a script block using runspace on the local system as well , the function in that module are accessible in the runspace script block. This module creates global variables. I tested…
deetle
  • 197
  • 8
-1
votes
1 answer

Why do I get exceptions when trying to use .Net PowerShell Runspace to connect to my local Windows 10 machine?

I'm trying to use PowerShell through .Net to connect to and and run some scripts on my local machine. I'm using Visual Studio 2019. I keep getting exceptions when I attempt to open my Runspace. Consider the following code snippet: private…
JohnB
  • 3,921
  • 8
  • 49
  • 99
-1
votes
1 answer

RunSpacePool output CSV contains blank rows

I am using this amazing answer and got RunSpacePools to output a CSV file but my CSV file has blank rows and I just cannot figure out where the blank rows are coming from. The blank lines are shown in Notepad as ,,, IF(Get-Command Get-SCOMAlert…
user4317867
  • 2,397
  • 4
  • 31
  • 57
-1
votes
1 answer

Runspace pipeline.invoke within a loop

I am making an application to collect a lot of exchange data and putting this into a nice interface. so far its working well, however I am running into an issue and I cannot figure it out. I am suspecting it has something to do with the fact that I…
Kage
  • 486
  • 1
  • 7
  • 18
1 2 3
18
19