Jump to content

Automate "advanced shareing" of certain drives in windows


Recommended Posts


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: )


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.



Edited by Konata
Link to comment
Share on other sites

_Net_Share_ShareAdd() in the Help file.

UDF List:

_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_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: 22/04/2018

Link to comment
Share on other sites

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.



Edited by Konata
Link to comment
Share on other sites

  • 10 months later...

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:



;row 2 drive 2

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

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

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


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
Link to comment
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

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...