Export (0) Print
Expand All
Expand Minimize

Set-ASApplication

Set-ASApplication

Used to enable auto-start for services in an application and for the application pool used by the application. You can specify that auto-start is enabled for all services in an application, or specify that auto-start must be enabled for individual services within the application (using T:Microsoft.ApplicationServer.Management.Commands.Enable-ASAppServiceAutoStart). To be able to enable or disable auto-start for a service, you must be using the Windows 7 or Windows Server 2008 R2 operating system. You enable auto-start for an application by executing the Set-ASApplication cmdlet with the AutoStartMode parameter. This adds the serviceAutoStartEnabled attribute set to a value of “true” to the applicationHost.config file at the server level. Setting the AutoStartMode parameter to a value of “All” enables auto-start for all services in the application, and sets the serviceAutoStartMode attribute for the application in the applicationHost.config file to a value of “all”. Setting the AutoStartMode parameter to “Custom” sets the serviceAutoStartMode attribute to a value of “Custom”. Setting AutoStartMode to “Disabled” sets serviceAutoStartMode to an empty string (or removes it).

Syntax

Parameter Set: SiteNameAndVirtualPath
Set-ASApplication [-SiteName] <String> [[-VirtualPath] <String> ] -AutoStartMode {<All> | <Custom> | <Disable>} [-EnableApplicationPool] [-Force] [-Confirm] [-WhatIf] [ <CommonParameters>]


Parameters

-ApplicationObject<ApplicationInfo>

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


Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

-AutoStartMode<ApplicationAutoStartMode>

Enable auto-start by setting the AutoStartMode parameter to a value of “All” or “Custom”. A value of “All” specifies that auto-start is enabled for all services in the application, and that the specific service auto-start settings are ignored. A value of “Custom” specifies that auto-start is not enabled for any service in the application unless auto-start is specifically enabled for the service. A value of “Disable” disables auto-start for the application.

Executing Set-ASApplication with no AutoStartMode parameter enables auto-start for all services in the application. This is equivalent to adding AutoStartMode parameter with a value of “All”.

The auto-start mode for a service is dependent upon the auto-start mode for an application. If you enable auto-start at the application level, auto-start will work for that application only if it is also enabled for the application pool used by that application.


The acceptable values for this parameter are:

All

Custom

Disable



Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

-EnableApplicationPool

Enables auto-start for the application pool used by the application, setting the startMode attribute of the Application Pool to “AlwaysRunning”. If you enable auto-start at the application level, auto-start will work for that application only if it is also enabled for the application pool used by that application.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

-Force

Forces the command to execute without asking for user confirmation.


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 an application or virtual directory contained within that site. To the SiteName parameter, you must add the VirtualPath parameter that identifies an application or virtual directory contained within the site. The virtual path must include the name of the application or virtual directory as defined in IIS. 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?

-Uri<Uri>

A URI for an IIS application or virtual directory, which specifies that the cmdlet will operate at that scope. If you use the Uri parameter, do not use 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 or directory, as defined in the IIS Manager Connections pane, which specifies that the cmdlet will operate at the scope of that application or virtual directory. You must add the VirtualPath parameter to the SiteName parameter, using SiteName to identify the site that the application or directory is included in. The leading "/" character in the virtual path is optional. The virtual path includes the name of the application or directory, as defined in IIS. 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?

-Confirm

Prompts you for confirmation before executing the command.


Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-WhatIf

Describes what would happen if you executed the command without actually executing the command.


Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

<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.

  • ApplicationInfo


Examples

EXAMPLE 1

Enables auto-start for all services in the myApp application of the Default Web Site, and enables auto-start for the application pool used by the myApp application.


Set-ASApplication -SiteName “Default Web Site” -VirtualPath “/myApp” -AutoStartMode “All” -EnableApplicationPool

EXAMPLE 2

Specifies that you can enable auto-start for a service in the myApp application of the Default Web Site by using the Enable-ASAppServiceAutoStart cmdlet. Auto-start will be disabled for any service in the myApp application if it is not enabled using Enable-ASAppServiceAutoStart. This example also enables auto-start for the application pool used by the myApp application.


Set-ASApplication -SiteName “Default Web Site” -VirtualPath “/myApp” -AutoStartMode “Custom” -EnableApplicationPool

EXAMPLE 3

Disables auto-start for all services in the myApp application of the Default Web Site.


Set-ASApplication -SiteName “Default Web Site” -VirtualPath “/myApp” -AutoStartMode “Disable”

EXAMPLE 4

Enables auto-start for all services in all applications of the Default Web Site. Also enables auto-start for the application pools used by those applications.


Get-Application –SiteName “Default Web Site” | Set-ASApplication -AutoStartMode “All” -EnableApplicationPool
Show:
© 2014 Microsoft