mtorbin Posted February 2, 2009 Share Posted February 2, 2009 Folks, I'm not entirely sure this is the best place for this question, but I think it mostly fits. I have a problem that I'm trying to solve which requires some knowledge of Windows that I don't have. I have a script that I wrote that needs to access a particular remote server using credentials. Ideally, what I'd like to have happen is the following: Script logs into 999.999.99.999/myDIR/ using a username and password. Script runs Script logs off of remote server. On a unix machine I can accomplish this with a mount/unmount. How would the same thing be accomplished using Windows? Thanks, - MT Quote Link to comment https://forums.phpfreaks.com/topic/143469-solved-mountunmount-on-windows-server/ Share on other sites More sharing options...
rhodesa Posted February 2, 2009 Share Posted February 2, 2009 with net NET USE you can mount a remote network share with an alternate user/pass: http://www.ss64.com/nt/net_use.html Quote Link to comment https://forums.phpfreaks.com/topic/143469-solved-mountunmount-on-windows-server/#findComment-752592 Share on other sites More sharing options...
mtorbin Posted February 2, 2009 Author Share Posted February 2, 2009 with net NET USE you can mount a remote network share with an alternate user/pass: http://www.ss64.com/nt/net_use.html UPDATE: I see that exec() will run on any system I'm on so I'm good to go. Thanks! Sweet, thanks Aaron! Ok, I've got the exact DOS line worked out. Now I just need to figure out how to execute it in PHP. - MT Quote Link to comment https://forums.phpfreaks.com/topic/143469-solved-mountunmount-on-windows-server/#findComment-752608 Share on other sites More sharing options...
mtorbin Posted February 2, 2009 Author Share Posted February 2, 2009 Finally, for those of you who are like me and need a written example of this, here's what worked for me: exec("NET USE Z: \\123.456.78.910\myDIR /USER:username password"); . . . [script runs] . . . exec("NET USE Z: /DELETE"); This will, if I wrote it properly in php, mount my remote server, run my script which is located locally, and then dismount from the remote server. Thanks again to Aaron for pointing me in the right direction! - MT Quote Link to comment https://forums.phpfreaks.com/topic/143469-solved-mountunmount-on-windows-server/#findComment-752624 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.