Problem Scenario: You are using Puppet Master on Linux and Puppet Agent on Windows servers. The manifest attempts to copy to or from a Windows network file share, but you are getting an error about the network path not existing. The network file share has permissions that are open to Everyone. What do you do?
Solution: Puppet Agent will run PowerShell commands under the security context of the user who runs the "puppet agent -t -d" command. If no one is logged in, the local system user will be the user whose security context is running the commands. For the first time that the network file share is used from the Windows server, it is sometimes necessary to use a command like this:
net use \\fileShareServer /USER:continual integration
Replace "fileShareServer" with the hostname of the file share. Any username and any password will work because the file share is open to Everyone. Note that there is no closing backslash after the fileShareServer name. So the Puppet manifest should look like this:
command => 'net use \\\fileShareServer /USER:continual integration; echo "this is the manifest command" > \\\fileShareServer'
Three backslashes in a manifest on Linux will translate to two backslashes on a Windows server. The main idea is that the "net use" command needs to run one time for initial use (and any credentials will suffice).