alanfox Posted April 10, 2012 Share Posted April 10, 2012 I want to be able to automate setting advanced sharing, public folder sharing and password protected sharing. I want to be able to do this via command line, vbscript, reg hack, ... However I can. I've googled and binged for days. Tried using regshot to look at before/after registry settings when I manually changed them. Nothing. Any help would be great. Or even if I can find where the settings are stored would be helpful. I can set network discovery and file and printer sharing with "netsh advfirewall firewall set rule group=" but there are no groups/rules for public folder sharing and password proteced sharing. Thank you. Link to comment Share on other sites More sharing options...
harshadhparulekar Posted April 11, 2012 Share Posted April 11, 2012 Try using AutoIT v3Use its Au3Record.exe to record all your key strokes and mouse clicks to setup your "advanced sharing". Also use it to de-setup/remove the "advanced sharing". Then use Aut2Exe.exe which comes with the AutoIT setup to generate an executable file from the recorded ".au3" file. Use the generated exe files as you want. The task will be automated, you just have to run the exe file. Most AutoIT users record only keystrokes and not mouse clicks to perform their automated tasks. This is because if the screen resolution is different than the one on which the script was recorded then the mouse clicks will not work as the x & y co-ordinates will change and the click will happen somewhere else than the intended position. Another recommendation is to stop using the keyboard and mouse when the Automated task is happening through the generated file. Link to comment Share on other sites More sharing options...
CoffeeFiend Posted April 11, 2012 Share Posted April 11, 2012 The standard way to manipulate network shares is using WMI, either via vbscript or powershell (both of which are built into Windows)Here's a quick example on technet's scripting guys that shows (and explains) how it works using powershell and here's the MSDN documentation for the Win32_Share class which you need to use.TL;DR: it's a 2 liner in powershell:$somevarname=[WMICLASS]"Win32_Share"$somevarname.Create("c:\somepath","SomeShareName",0)...unless you don't plan on doing anything else with shares, then you can even make it a one liner:[WMICLASS]"Win32_Share"|%{$_.Create("c:\somepath","SomeShareName",0)}It needs to be run elevated of course. You may want to change the share or NTFS permissions too. Link to comment Share on other sites More sharing options...
alanfox Posted April 11, 2012 Author Share Posted April 11, 2012 Thanks to everyone. I do not need a simple file share, I need to set advanced sharing options. I beleive that Au3Record may do what I want and I will try it. Thank you. Link to comment Share on other sites More sharing options...
CoffeeFiend Posted April 11, 2012 Share Posted April 11, 2012 I do not need a simple file share, I need to set advanced sharing options.Like I said, this creates a standard network share (not some sort of simplified share). If you want to set advanced options like permissions then you have to to it after (it's not magic). WMI is the standard, built-in way that MS gives admins to administer network shares (and lots of other things). Link to comment Share on other sites More sharing options...
alanfox Posted April 22, 2012 Author Share Posted April 22, 2012 This is what I need to automate:From Network and Sharing Center, select Advanced Sharing Options and on that windows set Public Folder Sharing and Password Protected Sharing toggles.If I can do that from WMI I would be VERY happy. But I am unable to find WMI classes that affect these two settings. Link to comment Share on other sites More sharing options...
CoffeeFiend Posted April 22, 2012 Share Posted April 22, 2012 If you look around, you'll even find pre-made scripts to do just this. That should serve as a good starting point. Link to comment Share on other sites More sharing options...
alanfox Posted April 22, 2012 Author Share Posted April 22, 2012 I'm sorry, I am either very thick, or I'm not properly explaining what I want to do. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now