![]() ![]() Type = "Directory" # The default is File. Configuration FileResourceDemoĮnsure = "Present" # Ensure the directory is Present on the target node. You still need to grant access to the account that will be used toĪccess the SourcePath. The Credential and PSDSCRunAsCredential both change the context the LCM uses Grant access to the SourcePath, give the target Node's computer account appropriate The LCM on the target Node executes in the context of the local system account by default. Recurse property ensures that all subdirectories are copied as well. The source directory is a UNC path ( \\PullServer\DemoSource) shared from the Pull Server. If the operation succeeds, the Log resource writes a confirmation message The following example copies a directory and its subdirectories from a pull server to a target node Property entirely, and remove any file at the specified path. An Ensure Absent setting would ignore the Attributes If you specified a value of ReadOnly for the Attributes property alongside aĭestinationPath, Ensure Present would create the path specified, while Contents.Only the directory specified will be copied. If you do not set the Recurse property to $true when copying a directory, none of theĬontents of the existing directory will be copied.Recurse, Force, and MatchSource change the type of copy operation performed, whileĬredential determines which account to use to access the source directory. When you specify a SourcePath and a DestinationPath with a Type value ofĭirectory, the resource copies source directory to the destination path.When you only specify a DestinationPath, the resource ensures that the path exists if.For more information, see Use Credentials with DSC Resources. Resource in the context of other credentials. The PsDscRunAsCredential common property was added in WMF 5.0 to allow running any DSC Sets the credential for running the entire resource as. Set it to Absent to ensure they do not exist. Set this property to Present to ensure the file exists. For example, if the ID of the resource configuration script block that you want to run first is ResourceName and its type is ResourceType, the syntax for using this property is DependsOn = "ResourceName".ĭetermines whether the file and Contents at the Destination should exist or not. Indicates that the configuration of another resource must run before this resource is configured. Please ensure your permissions are setĪccordingly, or use the Credential or PSRunAsCredential properties to specify the account UNC share, this could result in an "Access Denied" error. The computer account of the target node to access the SourcePath. ![]() If you do not specify a value for Credential or PSRunAsCredential, the resource will use If set to $false, the resource caches the contents of the source directory and ignores any files added after the initial copy. ![]() A value of $true indicates that, after the initial copy, any new source files should be copied to the destination. Default value is File.ĭetermines if the resource should monitor for new files added to the source directory after the initial copy. The path from which to copy the file or folder resource. Performs the state operation recursively to all directory content, subdirectories, and subdirectory content. Only valid when used with Type Directory. Overrides access operations that would result in an error (such as overwriting a file or deleting a directory that is not empty). The credentials that are required to access resources, such as source files. Indicates the contents to Ensure are Present or Absent from the targeted file. Valid values include: SHA-1, SHA-256, SHA-512, createdDate, modifiedDate. The checksum type to use when determining whether two files are the same. Valid values are Archive, Hidden, ReadOnly, and System. The desired state of the attributes for the targeted file or directory. The location, on the target node, you want to ensure is Present or Absent with Ensure. ![]() The PSDscResources module is available from the PowerShellįor more information and updated documentation, see the The PSDscResources module contains new and updated DSC Resources that are This documentation of this DSC resource covers the version that's included with PowerShell prior ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |