Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Configuration FileWithCredential {
- Import-DscResource -ModuleName PSDesiredStateConfiguration
- Node $AllNodes.NodeName {
- # copy files from a file share to a new folder on the target node
- File CopyFileShareFolder {
- Ensure = 'Present'
- Type = 'Directory'
- Recurse = $true
- SourcePath = '\filesharefoldersubfolderstuff_I_want_to_copy'
- DestinationPath = 'c:psDSCfilesharedestination'
- # If I use Credential instead of PsDscRunAsCredential, it works
- # Credential = Get-Credential -UserName ourdomainmyaccout -Message 'Enter Password'
- PsDscRunAsCredential = Get-Credential -UserName ourdomainmyaccout -Message 'Enter Password'
- }
- }
- }
- $ConfigData = @{
- AllNodes = @(
- @{
- NodeName = 'target-server'
- PsDscAllowDomainUser = $true
- PsDscAllowPlainTextPassword = $true
- }
- )
- }
- PS C:UsersmeDocumentspscodedsc_test2> FileWithCredential -ConfigurationData $ConfigData
- PS C:UsersmeDocumentspscodedsc_test2> Start-DscConfiguration .FileWithCredential -Verbose -Wait -Force
Add Comment
Please, Sign In to add comment