You can pass credentials when attaching to a UNC
--clear any ipc$ connections
net use \\server\share /delete
--map the drive
net use \\server\share /user:domain\username password
--do whatever you want
--cleanup
net use \\server\share /delete
it can also be...