Skip to content

Get SqlDscPreferredModule

dscbot edited this page Mar 3, 2024 · 2 revisions

Get-SqlDscPreferredModule

SYNOPSIS

Get the first available (preferred) module that is installed.

SYNTAX

Get-SqlDscPreferredModule [[-Name] <String[]>] [-Refresh] 
 [<CommonParameters>]

DESCRIPTION

Get the first available (preferred) module that is installed.

If the environment variable SMODefaultModuleName is set to a module name that name will be used as the preferred module name instead of the default module 'SqlServer'.

If the envrionment variable SMODefaultModuleVersion is set, then that specific version of the preferred module will be searched for.

EXAMPLES

EXAMPLE 1

Get-SqlDscPreferredModule

Returns the SqlServer PSModuleInfo object if it is installed, otherwise it will return SQLPS PSModuleInfo object if is is installed. If neither is installed $null is returned.

EXAMPLE 2

Get-SqlDscPreferredModule -Refresh

Updates the session environment variable PSModulePath and then returns the SqlServer PSModuleInfo object if it is installed, otherwise it will return SQLPS PSModuleInfo object if is is installed. If neither is installed $null is returned.

EXAMPLE 3

Get-SqlDscPreferredModule -Name @('MyModule', 'SQLPS')

Returns the MyModule PSModuleInfo object if it is installed, otherwise it will return SQLPS PSModuleInfo object if is is installed. If neither is installed $null is returned.

PARAMETERS

-Name

Specifies the list of the (preferred) modules to search for, in order. Defaults to 'SqlServer' and then 'SQLPS'.

Type: String[]
Parameter Sets: (All)
Aliases:

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

-Refresh

Specifies if the session environment variable PSModulePath should be refreshed with the paths from other environment variable targets (Machine and User).

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
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

OUTPUTS

System.Management.Automation.PSModuleInfo

NOTES

RELATED LINKS

Home

Commands

Resources

Usage

Clone this wiki locally