Skip to content

Import SqlDscPreferredModule

dscbot edited this page Mar 3, 2024 · 2 revisions

Import-SqlDscPreferredModule

SYNOPSIS

Imports a (preferred) module in a standardized way.

SYNTAX

Import-SqlDscPreferredModule [[-Name] <String>] [-Force] 
 [<CommonParameters>]

DESCRIPTION

Imports a (preferred) module in a standardized way. If the parameter Name is not specified the command will imports the default module SqlServer if it exist, otherwise SQLPS.

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

The module is always imported globally.

EXAMPLES

EXAMPLE 1

Import-SqlDscPreferredModule

Imports the default preferred module (SqlServer) if it exist, otherwise it will try to import the module SQLPS.

EXAMPLE 2

Import-SqlDscPreferredModule -Force

Will forcibly import the default preferred module if it exist, otherwise it will try to import the module SQLPS. Prior to importing it will remove an already loaded module.

EXAMPLE 3

Import-SqlDscPreferredModule -Name 'OtherSqlModule'

Imports the specified preferred module OtherSqlModule if it exist, otherwise it will try to import the module SQLPS.

PARAMETERS

-Force

Forces the removal of the previous module, to load the same or newer version fresh. This is meant to make sure the newest version is used, with the latest assemblies.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

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

-Name

Specifies the name of a preferred module.

Type: String
Parameter Sets: (All)
Aliases: PreferredModule

Required: False
Position: 1
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

OUTPUTS

NOTES

RELATED LINKS

Home

Commands

Resources

Usage

Clone this wiki locally