Guest User

Untitled

a guest
Apr 4th, 2018
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. Configuration FileWithCredential {
  2.  
  3. Import-DscResource -ModuleName PSDesiredStateConfiguration
  4.  
  5. Node $AllNodes.NodeName {
  6.  
  7. # copy files from a file share to a new folder on the target node
  8. File CopyFileShareFolder {
  9. Ensure = 'Present'
  10. Type = 'Directory'
  11. Recurse = $true
  12. SourcePath = '\filesharefoldersubfolderstuff_I_want_to_copy'
  13. DestinationPath = 'c:psDSCfilesharedestination'
  14. # If I use Credential instead of PsDscRunAsCredential, it works
  15. # Credential = Get-Credential -UserName ourdomainmyaccout -Message 'Enter Password'
  16. PsDscRunAsCredential = Get-Credential -UserName ourdomainmyaccout -Message 'Enter Password'
  17. }
  18. }
  19. }
  20.  
  21. $ConfigData = @{
  22. AllNodes = @(
  23. @{
  24. NodeName = 'target-server'
  25. PsDscAllowDomainUser = $true
  26. PsDscAllowPlainTextPassword = $true
  27. }
  28. )
  29. }
  30.  
  31. PS C:UsersmeDocumentspscodedsc_test2> FileWithCredential -ConfigurationData $ConfigData
  32. PS C:UsersmeDocumentspscodedsc_test2> Start-DscConfiguration .FileWithCredential -Verbose -Wait -Force
Add Comment
Please, Sign In to add comment