I am currently using a File resource with a credential which has been obtained through Get-Credential. I have a number of machines which are not on a domain but all on the same subnet. One of these machines has a share created on it, the file resource has this Share as its source specified as \10.10.10.1\MyShare. I have been messing around with the share/file permissions and local policy settings to try and get it accessible without credentials and I have found that SYSTEM users which are not on a domain cannot access a share which is also not on a domain. So I am now trying to use the credential option to access the share but I am getting this message:
A specified logon session does not exist. It may already have been terminated. An error occurs when accessing the network share with the specified credential. Please make sure the credential is correct and the network share is accessible. Note that Credential should not be specified with the local path.
Example Configuration:
$ConfigurationData =
@{
AllNodes =
@(
@{ NodeName = "*";
Source = "\\10.10.10.1\MyShare";
DestinationPath = "C:/DeployDirectory";
Credential = Get-Credential;
PSDscAllowPlainTextPassword = $true }
@{ NodeName = "10.10.10.1" }
@{ NodeName = "10.10.10.2" }
)
}
Configuration TestConfig
{
Node $AllNodes.NodeName
{
for ($i=1; $i -le 100; $i++)
{
File "Test$i"
{
Ensure = "Present"
Type = "File"
SourcePath = Join-Path $Node.Source "Test.zip"
DestinationPath = Join-Path $Node.DestinationPath "Test$i.zip"
MatchSource = $true
Force = $true
Checksum = "modifiedDate"
Credential = $Node.Credential
}
}
}
}
I want to know why this is, has anyone managed to get this working for the file resource? Thanks.