Sign in to follow this  
Followers 0
Konata

Automate "advanced shareing" of certain drives in windows

7 posts in this topic

#1 ·  Posted (edited)

Hi.

First I'd link to say Thanks for such a useful program, I've used it a-bit before for basic stuff but not in a long time so i've pritty much forgot everything.

So thought I would ask this awesome and very generous community for some help to tell me if this is possible (and maybe some help writing it for someone with a-bit of patience :graduated: )

/end_sucking_up

What I would like to do is automate sharing entire drives in my windows 7 system I use as a storage server. I control it remotely so will be quick if I can run a autoit script to easily do this when needed.

What I was thinking as if it was possible, if I have a txt file in each drives root directory that I want shared called sharename.txt. (with its contents just being my desired share name)

The Script could use that for the correct share name and somehow enter that into "advanced sharing" for me.

(Share name is also drive name if that's easier to obtain for the script)

I also need to remove everyone and add say the user "lazyadmin" to the share permissions with full control.

Is this possible or would I be wasting my time attemoting this with autoit.

Cheers

Konata

Edited by Konata

Share this post


Link to post
Share on other sites



I think the easiest way to do this is to use "net share" command.

Try "net share /?" in the command window and you will see what parameter you could have. Also, the batch file (.bat) could be written as data-driven.

Share this post


Link to post
Share on other sites

_Net_Share_ShareAdd() in the Help file.


_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Thanks for the quick reply's,

As archer suggested I was thinking of using the netstat command but couldn't figure out how I would name the drives share correctly, as they are not always the same drive letter for the path.

Also thanks for the pointer to it in the autoit help file,

Still not sure which way I will try to go yet.

Cheers

Konata

Edited by Konata

Share this post


Link to post
Share on other sites

I think you can use also WMI for sharing:

Br,

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

so confused lol.

Just fixed up some other problems so now i'm finally back to this one.

Though maybe I should of come back to it with more sleep :graduated:

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Took awile to come back to this. Although i ran into a problem:

I decided to make my life easyer I would just use mouse commands and send commands to share the drives via "my computer". since the resolution never changes I could just use x, y for the clicking.

Also thought when new drives added i only need to change afew lines and copy most of the rest once i got one right. (adding a line ";change" above those lines for my reference)

All explorer windows are being centered when they open by another program to keep the x, y mouse co-ordinates correct.

SO far I got:

"

"WinWaitActive("Computer")

;row 2 drive 2

MouseClick("right", 503, 197, 1)

MouseClick("left", 601, 250, 1)

MouseClick("left", 700, 250, 1)

;change

WinWaitActive("Sora (V:) Properties")

MouseClick("left", 652, 405, 1)

"

This brings me to the "advanced shareing" window in Windows 7.

My problem is I have not been successful getting past this. In particular ticking the tick box that shares the folder.

tried "mouseclick", mouse and click as seperate commands, "Controlclick" (though not 100% suire i was useing this 1 right),

also tried adding and removeing "WinWaitActive" and "WinActive" on all the above commands

Any sugestions would be awesome. i've been stuck at this line over 6 hours lol

The window appears to be in focus but I can;t seem to interact with it via the script.

Edited by Konata

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0