Hi,
I’m trying to copy file from one VM node to another and i get the following error:
“SourcePath must be accessible for current configuration”
i tried running the script from my local computer and it was successful
$inventoryFile = Get-Content -Path "$PSScriptRoot\NodeList.json" -Raw | ConvertFrom-Json
Configuration ServerDeploy {
param (
[PSCredential]$Pass
)
Import-DscResource -ModuleName PSDesiredStateConfiguration
Node $AllNodes.NodeName {
File "Copy Archive"
{
SourcePath = "S:\sss\ss" – intentionally removed servers names, but the structure is the same
DestinationPath = "\\sss\d$\s" – intentionally removed servers names, but the structure is the same
Ensure = "Present"
Type = "File"
Credential = $Cred
Force = $true
MatchSource = $true
Recurse = $true
}
Archive "Expand Archive"
{
Destination = "D:\sss\s"- intentionally removed servers names, but the structure is the same
Path = "\\sss\d$\ss\s"- intentionally removed servers names, but the structure is the same
Ensure = "Present"
Credential = $Cred
Force = $true
}
}
}
function Deploy-Config () {
param (
[PSCredential]$Cred
)
$ConfigData = @{
AllNodes = @(
)
}
foreach ($server in $inventoryFile.NodeNames) {
$ConfigData.AllNodes += @{NodeName = $server;PSDscAllowDomainUser = $true;PSDscAllowPlainTextPassword=$true}
}
ServerDeploy -ConfigurationData $ConfigData -Cred $Cred -OutputPath "S:\MOF\"
$cim = New-CimSession -ComputerName $ConfigData.AllNodes.NodeName -Credential $Cred
Start-DscConfiguration -CimSession $cim -Path "S:\MOF\" -ThrottleLimit 3 -Verbose -Force -Wait
}