Best way to map a drive on windows
I need to have puppet map a drive for a windows user. I saw there was as similar question here https://ask.puppetlabs.com/question/4... but this had very little explanation and the gist is gone now.
I know I could just have an exec in a node definition but that seems very un-puppetlike. I'm thinking I should create a new resource, something like "mapped drive" but being totally new to puppet, I'm kind of at a loss how to accomplish this.
Edit: This turned out to be unnecessary for my use case. However I'm revisiting in an attempt to learn more puppet. I have attempted your suggestion #3 and am stymied. A simple $network.MapNetworkDrive maps the drive fine. AS A USER. Puppet runs as admin though and admin mapped drives are not visible to users. I set EnableLinkedConnections=1 in registry solved this FOR MANUAL runs. When puppet runs my provider code, which is mainly just a Test-Path in exists?, then MapNetworkDrive and correspondign remove in destroy. I thought it should be as simple as that however it seems puppet running those same commands does not update the drives existence in explorer as when I run the exact same command from a admin powershell prompt. A more disconcerting problem is when the drive is removed by puppet. The drive remains in explorer as disconnected and unremovable and "nonexistent." I have tracked down many posts and discussions on these shortcomings on windows and am beginning to see why puppet has not implemented this functionality yet.
What is this discrepancy in how puppet is running the command?