Share via


Get-ASAppServiceInstance

Get-ASAppServiceInstance

Gets service instance objects from one or more persistence stores.

Syntax

Parameter Set: RootConfig
Get-ASAppServiceInstance [-Condition {<Active> | <Canceled> | <Exception> | <Idle> | <Successful> | <Terminated> | <UserSuspension>} ] [-Count] [-CreatedTimeFrom <DateTime> ] [-CreatedTimeTo <DateTime> ] [-ExceptionName <String> ] [-ExcludeSubfolders] [-GroupBy {<Condition> | <ExceptionName> | <MachineName> | <ServiceType> | <SiteName> | <Status> | <UniqueApplication> | <UniqueService>} ] [-InstanceId <Guid> ] [-MachineName <String> ] [-MaxRows <Int32> ] [-ModifiedTimeFrom <DateTime> ] [-ModifiedTimeTo <DateTime> ] [-OrderBy {<LastUpdatedTimeDescending>} ] [-Root] [-ServiceType <String> ] [-SiteNameFilter <String> ] [-Status {<Completed> | <Running> | <Suspended>} ] [-Timeout <TimeSpan> ] [-VirtualPathFilter <String> ] [ <CommonParameters>]

Detailed Description

This cmdlet queries a specified set of persistence stores and returns a collection of service instances that match supplied query parameters. There are three kinds of parameters to the Get-ASAppServiceInstance cmdlet: persistence stores to query, query parameters, and formatting parameters.

Parameters

-ApplicationObject<ApplicationInfo>

The name of the ApplicationObject, which specifies that the cmdlet will operate on that application. This parameter is used to pipe the output of the Get-ASApplication cmdlet to a cmdlet containing the ApplicationObject parameter.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

-Condition<InstanceCondition>

Specifies the instance condition. If specified, only service instances of the specified condition are returned by the query. This is an optional parameter. The possible values for this parameter are:

The acceptable values for this parameter are:

Active

Canceled

Exception

Idle

Successful

Terminated

UserSuspension

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

-Count

Specifies that only a count of the number of instances that match the query parameters should be returned. This is an optional parameter.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

-CreatedTimeFrom<DateTime>

Specifies the start of a range of time at which a service instance was first started. If this parameter is specified, only instances started on or after the given timestamp are returned. This is an optional parameter.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

-CreatedTimeTo<DateTime>

Specifies the end of a range of time at which a service instance was first started. If this parameter is specified, only instances started on or before the given timestamp are returned. This is an optional parameter.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

-ExceptionName<String>

Specifies a string representing the fully qualified type name of a .NET exception. If specified, only service instances that are associated with the specified exception in persistence store are returned.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

-ExcludeSubfolders

If specified, the cmdlet queries instance stores associated with the scope, but does not query instances associated with contained scopes. For example, if you execute this cmdlet against –root scope with –ExcludeSubFolders option specified, the cmdlet queries the stores defined at the root level only. It does not query stores defined at site and application scopes. This is an optional parameter.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

-GroupBy<GroupingMode>

Specifies a field that is used to group the returned service instances or counts of service instances. This is an optional parameter. The possible values for this parameter are:

The acceptable values for this parameter are:

Condition

ExceptionName

MachineName

ServiceType

SiteName

Status

UniqueApplication

UniqueService

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

-InstanceId<Guid>

Specifies instance IDs (specified as GUID[]) of service instances to return. The instance ID uniquely identifies a service instance. This parameter is an optional parameter.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

-InstanceStoreInfo<InstanceStoreInfo>

Specifies the instance stores that should be queried. This is an optional parameter.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

-MachineName<String>

Specifies a computer name. If specified, only service instances locked by this computer are returned. This is an optional parameter.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

-MaxRows<Int32>

Specifies the maximum number of service instances to return. This is an optional parameter.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

-ModifiedTimeFrom<DateTime>

Specifies the start of a range of time at which a service instance was modified. If this parameter is specified, only instances modified on or after the given timestamp are returned. This is an optional parameter.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

-ModifiedTimeTo<DateTime>

Specifies the end of a range of time at which a service instance was modified. If this parameter is specified, only instances modified on or before the given timestamp are returned. This is an optional parameter.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

-OrderBy<Order>

Specifies sorting criteria that are applied to the query for service instances. This is an optional parameter. The possible sort criteria are:

The acceptable values for this parameter are:

LastUpdatedTimeDescending

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

-Root

The name of the root application, which specifies that the cmdlet will operate at that scope. If you use the Root parameter, do not use the SiteName, VirtualPath, or Uri parameter.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

-ServiceObject<ServiceInfo>

The name of the ServiceObject, which specifies that the cmdlet will operate on that service. This parameter is typically used to pipe the output of the Get-ASAppService cmdlet to a cmdlet containing the ServiceObject parameter.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

-ServiceType<String>

Specifies the type of service. If specified, only instances of this service type are returned. The service type may be expressed as a full or partial path or as a fully or partially qualified .NET name and namespace. When you specify a service type by namespace, you must use the XName.ToString() format to separate the service type from the namespace. For example, if the fully qualified .NET CLR service name is Contoso.Web.Sales.POService, the parameter value should be "{Contoso.Web.Sales}POService". This is an optional parameter.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

-SiteName<String>

The name of a Web site, as defined in the IIS Connections pane, which specifies that the cmdlet will operate at the scope of that site, or at the scope of an application, virtual directory, or service contained within that site. To the SiteName parameter, you can add the VirtualPath parameter that identifies an application, directory, or service included in the site.

For an application or virtual directory, the virtual path includes the name of the application, as defined in IIS. For a service, the virtual path includes the name of the application, a forward slash, and the name of the .svc file or .xamlx file for the service. The VirtualPath parameter is not necessary for the site scope. The leading "/" character in the virtual path is optional. If you use the SiteName parameter, do not use the Uri parameter.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

true (ByPropertyName)

Accept Wildcard Characters?

-SiteNameFilter<String>

If this parameter is specified, only instances with a matching site name are returned. This is an optional parameter.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

-Status<InstanceStatus>

Specifies the instance status. If specified, only service instances in the specified state are returned by the query. The possible values for this parameter are:

The acceptable values for this parameter are:

Completed

Running

Suspended

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

-Timeout<TimeSpan>

Specifies how long the cmdlet waits for the response from the database. The value is a time value of the format hh:mm:ss. The minimum value is 00:00:01 (1 sec), the maximum value is TimeSpan.MaxValue. If omitted, defaults to 00:02:00 (2 min). A timeout exception is thrown if there are any stores that haven't returned results. The cmdlet returns partial results to the caller unless the –Count parameter is specified. This is an optional parameter.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

-Uri<Uri>

A URI for an IIS site, application, virtual directory, or service, which specifies that the cmdlet will operate at that scope. If you use the Uri parameter, do not use the SiteName parameter or the SiteName and VirtualPath parameter set.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

true (ByPropertyName)

Accept Wildcard Characters?

-VirtualPath<String>

The virtual path for an application, directory, or service, as defined in the IIS Manager Connections pane, which specifies that the cmdlet will operate at the application, virtual directory, or service. You must add the VirtualPath parameter to the SiteName parameter, using SiteName to identify the site that the application, directory, or service is contained within. The leading "/" character in the virtual path is optional.

For an application, the virtual path includes the name of the application, as defined in IIS. For a service, the virtual path includes the name of the application, a forward slash, and the name of the .svc file or .xamlx file for the service. If you use the SiteName and VirtualName parameter set, do not use the Uri parameter.

Aliases

none

Required?

false

Position?

2

Default Value

none

Accept Pipeline Input?

true (ByPropertyName)

Accept Wildcard Characters?

-VirtualPathFilter<String>

If this parameter is specified, only instances with a matching virtual path are returned. This is an optional parameter.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see about_CommonParameters

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

  • None.

Outputs

The output type is the type of the objects that the cmdlet emits.

  • None.

Examples

Example 1

This command returns all instances in the default persistence store.

Get-ASAppServiceInstance

Example 2

This command returns all service instances that are currently unloaded and persisted in the default persistence store.

Get-ASAppServiceInstance –Condition "Idle"

Example 3

This command assigns $myServiceInstances to a collection containing all instances of the service /SampleApp/SampleService.xamlx on the site "Default Web Site".

$myServiceInstances = Get-ASAppServiceInstance –SiteName “Default Web Site” –VirtualPath /SampleApp/SampleService.xamlx

Example 4

This command assigns $myServiceInstances to a collection containing all running instances of the service /MyApp/service1.xamlx on the site "My Site".

$myRunningInstances = Get-ASAppServiceInstance –SiteName “My Site” –VirtualPath /MyApp/service1.xamlx –Status “Running

Example 5

This command suspends all running service instances.

Get-ASAppServiceInstance –Status “Running” | Suspend-ASAppServiceInstance

Example 6

This command resumes all suspended service instances.

Get-ASAppServiceInstance –Status “Suspended” | Resume-ASAppServiceInstance

Example 7

This command stops all running instances of the service /MyApp/service1.xamlx on the site "My Site".

Get-ASAppServiceInstance –SiteName “My Site” –VirtualPath /MyApp/service1.xamlx –Status “Running” | Stop-ASAppServiceInstance

Example 8

This command terminates all running instances of the service /MyApp/service1.xamlx on the site "My Site".

Get-ASAppServiceInstance –SiteName “My Site” –VirtualPath /MyApp/service1.xamlx –Status “Running” | Stop-ASAppServiceInstance -Terminate

Example 9

This command gets information about an instance whose ID is: 7A370AA0-3218-11DF-B1EC-1DDC55D89593.

Get-AsAppServiceInstance -InstanceId 7A370AA0-3218-11DF-B1EC-1DDC55D89593

Example 10

This command returns instances grouped by status from the default persistence store.

Get-ASAppServiceInstance –GroupBy ”Condition”