# PowerShellScriptResource

- Kind: `class`
- Package: [CommunityToolkit.Aspire.Hosting.PowerShell](/reference/api/csharp/communitytoolkit.aspire.hosting.powershell.md)
- Version: `13.4.0`
- Namespace: `CommunityToolkit.Aspire.Hosting.PowerShell`
- Target framework: `net10.0`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/blob/d9dc6fc02412d7398c5722840513d99965a6e98f/src/CommunityToolkit.Aspire.Hosting.PowerShell/PowerShellScriptResource.cs)
- Inherits: `Resource`
- Implements: `IResource`, `IResourceWithArgs`, `IResourceWithEnvironment`, `IResourceWithWaitSupport`, `IDisposable`

Represents a PowerShell script resource.

## Definition

```csharp
namespace CommunityToolkit.Aspire.Hosting.PowerShell;

public class PowerShellScriptResource
    : Aspire.Hosting.ApplicationModel.Resource,
      Aspire.Hosting.ApplicationModel.IResource,
      Aspire.Hosting.ApplicationModel.IResourceWithArgs,
      Aspire.Hosting.ApplicationModel.IResourceWithEnvironment,
      Aspire.Hosting.ApplicationModel.IResourceWithWaitSupport,
      System.IDisposable
{
    // ...
}
```

## Constructors

- [PowerShellScriptResource(string, ScriptBlock, PowerShellRunspacePoolResource)](/reference/api/csharp/communitytoolkit.aspire.hosting.powershell/powershellscriptresource/constructors.md#constructor-string-scriptblock-powershellrunspacepoolresource) -- Initializes a new instance of the [PowerShellScriptResource](/reference/api/csharp/communitytoolkit.aspire.hosting.powershell/powershellscriptresource.md) class, representing a resource for executing PowerShell scripts.
- [PowerShellScriptResource(string, FileInfo, PowerShellRunspacePoolResource)](/reference/api/csharp/communitytoolkit.aspire.hosting.powershell/powershellscriptresource/constructors.md#constructor-string-fileinfo-powershellrunspacepoolresource) -- Initializes a new instance of the [PowerShellScriptResource](/reference/api/csharp/communitytoolkit.aspire.hosting.powershell/powershellscriptresource.md) class, representing a resource for executing PowerShell scripts.

## Properties

- [Parent](/reference/api/csharp/communitytoolkit.aspire.hosting.powershell/powershellscriptresource/properties.md#parent) : [PowerShellRunspacePoolResource](/reference/api/csharp/communitytoolkit.aspire.hosting.powershell/powershellrunspacepoolresource.md) `get` -- Parent PowerShell runspace pool resource that provides the runspace pool for script execution.

## Methods

- [BreakAsync](/reference/api/csharp/communitytoolkit.aspire.hosting.powershell/powershellscriptresource/methods.md#breakasync) : `Task<bool>` -- Breaks the PowerShell script execution.
- [StartAsync(ILogger, ResourceNotificationService, CancellationToken)](/reference/api/csharp/communitytoolkit.aspire.hosting.powershell/powershellscriptresource/methods.md#startasync-ilogger-resourcenotificationservice-cancellationtoken) : `Task` -- Starts the execution of the PowerShell script asynchronously, publishing state updates and handling script arguments as needed.
