Kinda managed to sort my own problem... I used this snippet in my PowerShell script:
# Super-secret credentials... $network_user = "domain\user" $network_password = "monkey123" # Where do we want to connect to - note: do not use a trailing \ $remotepath = "\\server\path" # Convert to a secure string... $PWord = ConvertTo-SecureString $network_password -AsPlainText -Force # .. and create a credential object $myCreds = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $network_user,$PWord # Map a drive to the network path... New-PSDrive -Name Z -PSProvider FileSystem -Root $remotepath -Credential $myCreds # Query the remote path - note we're NOT using the mapped drive... Get-ChildItem $remotepath # Call other commands against $remotepath... What's neat about this is that you don't actually need to use the mapped drive - I guess you could even remove it straight after creating it. I think this works because you're creating an authenticated connection to the $remotepath which persists throughout the script. Would still be interesting in getting "become" working but that's for another day. -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/2f8c7ddc-1502-43db-9486-019dcecca1cc%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
