I’m trying to write up a small DSC PoC (vs Ansible), and as part of that, I want to copy required DSC Resources to the Windows 2016 server I’m running it on.
The server doesn’t have internet access, so I can’t download them directly from the Gallery.
Configuration Data:
$ConfigurationData = @{
AllNodes = @(
@{
NodeName="*"
PSDscAllowPlainTextPassword=$True
PSDscAllowDomainUser=$True
}
);
}
The Configuration:
Configuration DSCPOCCopyDSCResources {
param (
[Parameter()]
[PSCredential]$Credential
)
Node 'localhost' {
File DirectoryCopy
{
SourcePath = "\\Share\Common\DevSupport\PowerShell.DSC.Resources"
DestinationPath = "C:\Program Files\WindowsPowerShell\Modules"
Recurse = $True
Type = "Directory"
Ensure = "Present"
PSDSCRunAsCredential = $Credential
}
}
}
Then I run:
$Cred = (Get-Credential) DSCPOCCopyDSCResources -OutputPath C:\Temp\ -ConfigurationData $ConfigurationData -Credential (Get-Credential)
I then get this output/error:
VERBOSE: Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = SendConfigurationApply,'className' = MSFT_DSCLocalConfigurationManager,'namespaceName' =
root/Microsoft/Windows/DesiredStateConfiguration'.
VERBOSE: An LCM method call arrived from computer SRV-PSDSC03 with user sid S-1-5-21-3324808359-1710566943-1674697894-74334.
VERBOSE: [SRV-PSDSC03]: LCM: [ Start Set ]
VERBOSE: [SRV-PSDSC03]: LCM: [ Start Resource ] [[File]DirectoryCopy]
VERBOSE: [SRV-PSDSC03]: LCM: [ Start Test ] [[File]DirectoryCopy]
VERBOSE: [SRV-PSDSC03]: [[File]DirectoryCopy] Access is denied.
VERBOSE: [SRV-PSDSC03]: [[File]DirectoryCopy] The related file/directory is: \\Share\Common\DevSupport\PowerShell.DSC.Resources.
VERBOSE: [SRV-PSDSC03]: [[File]DirectoryCopy] The path cannot point to the root directory or to the root of a net share.
VERBOSE: [SRV-PSDSC03]: [[File]DirectoryCopy] The related file/directory is: \\Share\Common\DevSupport\PowerShell.DSC.Resources.
VERBOSE: [SRV-PSDSC03]: [[File]DirectoryCopy] SourcePath must be specified if you want to configure the destination directory recursively. Make sure that SourcePath is a directory and that it
is accessible.
SourcePath must be specified if you want to configure the destination directory recursively. Make sure that SourcePath is a directory and that it is accessible.
+ CategoryInfo : InvalidArgument: (:) [], CimException
+ FullyQualifiedErrorId : MI RESULT 4
+ PSComputerName : localhost
I first tried Credential instead of PSDSCRunAsCredential, but same error.
The user sid corresponds to my admin account.
Any ideas what I am doing wrong?
I have also tried opening the share in Explorer as well as running Test-Path, both successful…