< Back

Initialize-DSCResource

Mon Jan 13, 2020 12:35 am

NAME Initialize-DSCResource



SYNOPSIS

Initializes DSC resources within a module





SYNTAX

Initialize-DSCResource [-ModuleRoot] <String> [-Force] [-MinimumVersion <Version>] [-MaximumVersion <Version>]

[<CommonParameters>]





DESCRIPTION

Initializes DSC resources within a module, based off of scripts named *.version.resource.ps1 (i.e.

foo.1.0.resource.ps1)





PARAMETERS

-ModuleRoot <String>

The root directory of the module.



Required? true

Position? 1

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-Force [<SwitchParameter>]

If set, will always recreate resources, even if they are the same version



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-MinimumVersion <Version>

If provided, will not initialize resources whose version number is less then the provided value



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-MaximumVersion <Version>

If provided, will not initialize resources whose version number is greater then the provided value



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS

System.Nullable





NOTES





The .resource.ps1 files are used as a quick way to write a DSC resource.



They are expected to contain a call to Write-DSCResource, and that call will use some default parameters based

off of what was provided to Initialize-DSCResource. -ModuleRoot will be the base path of the module, and

-ResourceName and -ResourceVersion will be inferred from the file.



-------------------------- EXAMPLE 1 --------------------------



PS C:\\>Initialize-DSCResource $env:ProgramFiles\\WindowsPowerShell\\Modules\\cFg















RELATED LINKS

Reset-DSCResource