Set‑SqlDscRSVirtualDirectory - dsccommunity/SqlServerDsc GitHub Wiki

SYNOPSIS

Sets the virtual directory for SQL Server Reporting Services.

SYNTAX

Set-SqlDscRSVirtualDirectory [-Configuration] <Object> [-Application] <String> [-VirtualDirectory] <String>
 [[-Lcid] <Int32>] [-PassThru] [-Force] [-WhatIf] [-Confirm]
 [<CommonParameters>]

DESCRIPTION

Sets the virtual directory for SQL Server Reporting Services or Power BI Report Server by calling the SetVirtualDirectory method on the MSReportServer_ConfigurationSetting CIM instance.

This command must be called before URL reservations can be added for a Reporting Services application. The virtual directory defines the path segment in the URL used to access the application.

The configuration CIM instance can be obtained using the Get-SqlDscRSConfiguration command and passed via the pipeline.

EXAMPLES

EXAMPLE 1

Get-SqlDscRSConfiguration -InstanceName 'SSRS' | Set-SqlDscRSVirtualDirectory -Application 'ReportServerWebService' -VirtualDirectory 'ReportServer'

Sets the virtual directory for the Report Server Web Service to 'ReportServer'.

EXAMPLE 2

$config = Get-SqlDscRSConfiguration -InstanceName 'SSRS'
Set-SqlDscRSVirtualDirectory -Configuration $config -Application 'ReportServerWebApp' -VirtualDirectory 'Reports' -Confirm:$false

Sets the virtual directory for the Reports web application to 'Reports' without confirmation.

EXAMPLE 3

Get-SqlDscRSConfiguration -InstanceName 'SSRS' | Set-SqlDscRSVirtualDirectory -Application 'ReportServerWebService' -VirtualDirectory 'ReportServer' -PassThru

Sets the virtual directory and returns the configuration CIM instance.

PARAMETERS

-Application

Specifies the application for which to set the virtual directory. Valid values are:

  • 'ReportServerWebService': The Report Server Web Service.
  • 'ReportServerWebApp': The Reports web application (SQL Server 2016+).
  • 'ReportManager': The Report Manager (SQL Server 2014 and earlier).
Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Configuration

Specifies the MSReportServer_ConfigurationSetting CIM instance for the Reporting Services instance. This can be obtained using the Get-SqlDscRSConfiguration command. This parameter accepts pipeline input.

Type: Object
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False

-Force

If specified, suppresses the confirmation prompt.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-Lcid

Specifies the language code identifier (LCID) for the virtual directory. If not specified, defaults to the operating system language. Common values include 1033 for English (US).

Type: Int32
Parameter Sets: (All)
Aliases:

Required: False
Position: 4
Default value: 0
Accept pipeline input: False
Accept wildcard characters: False

-PassThru

If specified, returns the configuration CIM instance after setting the virtual directory.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-VirtualDirectory

Specifies the virtual directory name. This is the path segment used in the URL to access the application. Common values are 'ReportServer' for the web service and 'Reports' for the web portal.

Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

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

INPUTS

Microsoft.Management.Infrastructure.CimInstance

Accepts MSReportServer_ConfigurationSetting CIM instance via pipeline.

OUTPUTS

None. By default, this command does not generate any output.

Microsoft.Management.Infrastructure.CimInstance

When PassThru is specified, returns the MSReportServer_ConfigurationSetting

CIM instance.

NOTES

The virtual directory must be set before URL reservations can be added for the application. After setting the virtual directory, use Add-SqlDscRSUrlReservation to add URL reservations.

The Reporting Services service may need to be restarted for the change to take effect.

RELATED LINKS

https://docs.microsoft.com/en-us/sql/reporting-services/wmi-provider-library-reference/configurationsetting-method-setvirtualdirectory

⚠️ **GitHub.com Fallback** ⚠️