# PowerShellScriptResource Methods

- Package: [CommunityToolkit.Aspire.Hosting.PowerShell](/reference/api/csharp/communitytoolkit.aspire.hosting.powershell.md)
- Type: [PowerShellScriptResource](/reference/api/csharp/communitytoolkit.aspire.hosting.powershell/powershellscriptresource.md)
- Kind: `Methods`
- Members: `2`

Represents a PowerShell script resource.

## BreakAsync

- Name: `BreakAsync`
- Returns: `Task<bool>`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/blob/67afcca30f02c18687f9c5219313710af9706630/src/CommunityToolkit.Aspire.Hosting.PowerShell/PowerShellScriptResource.cs#L101-L114)

Breaks the PowerShell script execution.

```csharp
public class PowerShellScriptResource
{
    public Task<bool> BreakAsync()
    {
        // ...
    }
}
```

## StartAsync(ILogger, ResourceNotificationService, CancellationToken)

- Name: `StartAsync(ILogger, ResourceNotificationService, CancellationToken)`
- Returns: `Task`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/blob/67afcca30f02c18687f9c5219313710af9706630/src/CommunityToolkit.Aspire.Hosting.PowerShell/PowerShellScriptResource.cs#L128-L200)

Starts the PowerShell script execution.

```csharp
public class PowerShellScriptResource
{
    public Task StartAsync(
        ILogger scriptLogger,
        ResourceNotificationService notificationService,
        CancellationToken cancellationToken = default(CancellationToken))
    {
        // ...
    }
}
```

## Parameters

- `scriptLogger` (`ILogger`)
- `notificationService` (`ResourceNotificationService`)
- `cancellationToken` (`CancellationToken`) `optional`

## Exceptions

- `ArgumentOutOfRangeException`
