Stealth111 Posted March 14, 2007 Share Posted March 14, 2007 I am desperately looking for help on this.. I HAVE searched the forums "syslistview32" ect..and Google extensively for something that would do a very small task for me. I need someones help on setting the checkbox on "File and Print Sharing for Microsoft Networks" in the "local area connection properties" box.. I have roughly 2200 systems that mostly don't have this setting enabled(checked), and I really need a way to do this easily without going to each machine and clicking all over the place to set this.. I am reaching out here for help as you all have been really helpful in the past in coming to the rescue with some great help. Please if anyone has ANY way of doing this at all please give me a way to go!! Thanks!! Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted March 14, 2007 Moderators Share Posted March 14, 2007 (edited) First you need to download these files and put them on a network share or do a FileInstall(), which ever you prefer.snetcfg.exe - W2Ksnetcfg_wxp.exe - XPNow here is the code, just update $sSnetcfgDir accordingly.$sSnetcfgDir = "\\server\share\" ; Be sure and include the trailing backslash $sVersion = @OSVersion Switch $sVersion Case "WIN_XP" $sSnetcfgPath = $sSnetcfgDir & "snetcfg_wxp.exe" Case "WIN_2000" $sSnetcfgPath = $sSnetcfgDir & "snetcfg.exe" EndSwitch ShellExecuteWait($sSnetcfgPath, " -u MS Server", @WorkingDir, Default, @SW_HIDE) ShellExecuteWait($sSnetcfgPath, " -l " & @WindowsDir & "\Inf\NETSERV.INF -c s -i MS_Server", @WorkingDir, Default, @SW_HIDE) RunWait("NET STOP BROWSER", @WorkingDir, @SW_HIDE) RunWait("NET STOP SERVER", @WorkingDir, @SW_HIDE) RunWait("NET START BROWSER", @WorkingDir, @SW_HIDE) RunWait("NET START SERVER", @WorkingDir, @SW_HIDE)WARNING: THIS CODE IS UNTESTED! (Use at your own risk) Edited March 14, 2007 by big_daddy Link to comment Share on other sites More sharing options...
PaulIA Posted March 14, 2007 Share Posted March 14, 2007 I am desperately looking for help on this.. I HAVE searched the forums "syslistview32" ect..and Google extensively for something that would do a very small task for me. I need someones help on setting the checkbox on "File and Print Sharing for Microsoft Networks" in the "local area connection properties" box.. I have roughly 2200 systems that mostly don't have this setting enabled(checked), and I really need a way to do this easily without going to each machine and clicking all over the place to set this.. I am reaching out here for help as you all have been really helpful in the past in coming to the rescue with some great help. Please if anyone has ANY way of doing this at all please give me a way to go!! Thanks!!If you want to do this the way a user would do it (i.e. opening the dialog and checking the checkbox), grab a copy of Auto3Lib from my signature and run this: expandcollapse popup#include <A3LListView.au3> #include <A3LMenu.au3> Global $hList, $iIndex ; Run the "Network and Dialup Connections" dialog Run("RunDll32.exe shell32.dll,Control_RunDLL ncpa.cpl") _Lib_WinWaitActive("Network Connections") ; Get the "Network Connections" ListView handle $hList = ControlGetHandle("Network Connections", "", "SysListView321") if @Error then _Lib_ShowError("Unable to get Network Connections ListView handle") ; Find the Local Area Connections item $iIndex =_ListView_FindText($hList, "Local Area Connection") if $iIndex = -1 then ; No Local Area Connections, try Internet Connection $iIndex = _ListView_FindText($hList, "Internet Connection") if $iIndex = -1 then _Lib_ShowError("You do not have a network connection") endif ; Right click on the item _ListView_ClickItem($hList, $iIndex, "right", False, 1, 1, True) ; Select the "Properties" menu item from the popup menu _Menu_ClickPopupAccel("r") _Lib_WinWaitActive("Local Area Connection Properties") ; Get the ListView handle $hList = ControlGetHandle("Local Area Connection Properties", "", "SysListView321") if @Error then _Lib_ShowError("Unable to get Local Area Connection Properties ListView handle") ; Search for "File and Printer Sharing" $iIndex = _ListView_FindText($hList, "File and Printer Sharing") if $iIndex = -1 then _Lib_ShowError('Unable to find "File and Printer Sharing"') ; Check item checked state (2 = checked, 3 = unchecked) if BitShift(_ListView_GetItemState($hList, $iIndex, $LVIS_STATEIMAGEMASK), 12) = 3 then _ListView_ClickItem($hList, $iIndex) Send("{SPACE}") ; Add code here to click the "OK" button to save the change endif ; Add code here to close the open dialogs if needed Auto3Lib: A library of over 1200 functions for AutoIt Link to comment Share on other sites More sharing options...
SNissen Posted June 4, 2008 Share Posted June 4, 2008 This script, only a year old, is exactly what I need, but... it uses Auto3Lib, which no longer exists. Can someone translate it to the current version of AutoIt? Or, point me to a conversion guide (Auto3Lib to the new GUI calls) so I can translate it? I'm not afraid of programming, but I've done very little work in AutoIt... Yet. Sande Link to comment Share on other sites More sharing options...
SNissen Posted June 13, 2008 Share Posted June 13, 2008 (edited) I've received no response to my plea for help in translating this Aut3lib script to the latest version of AutoIt. Please, can anyone help? I'll have to give up on AutoIt if I can't get this to work. Sande Edited June 13, 2008 by SNissen Link to comment Share on other sites More sharing options...
cartman380 Posted June 13, 2008 Share Posted June 13, 2008 Here is some code that I used when I first started using autoit, I know a better way to do it now but I don't have the time to write it right now so here is the portion of my code that you can change to fit it to what you need. expandcollapse popupRun("rundll32 printui.dll,PrintUIEntry /il") WinWaitActive("Add Printer Wizard") WinActivate("Add Printer Wizard") Send("!N") WinWaitActive("Add Printer Wizard", "Local printer") Send("!L") If (ControlCommand("Add Printer Wizard", "", "4665", "IsChecked", "")) Then ControlCommand("Add Printer Wizard", "", "4665", "UnCheck", "") Send("!N") WinWaitActive("Add Printer Wizard", "Use the following port") Send("!U") ControlClick("Add Printer Wizard", "", "3100") Send("nu") Send("!N") WinWaitActive("Add Printer Wizard", "Select the manufacturer and model") $PrinterMan = ControlListView("Add Printer Wizard", "", "SysListView321", "FindItem", "Generic", 0) ControlListView("Add Printer Wizard", "", "SysListView321", "Select", $PrinterMan) Send("{TAB}") Send("generic / text only") Send("!N") WinWaitActive("Add Printer Wizard", "name for this printer", 1) If (WinActive("Add Printer Wizard", "Do you want to keep the existing driver")) Then Send("!K") Send("!N") WinWaitActive("Add Printer Wizard", "name for this printer") EndIf $NetNum = String($NetConst + $count) $Temp = "NET" & $NetNum Send($Temp) Send("!o") Send("!N") WinWaitActive("Add Printer Wizard", "share this printer", 1) If (WinActive("Add Printer Wizard", "share this printer")) Then ControlCommand("Add Printer Wizard", "", "3227", "Check", "") Send("!N") WinWaitActive("Add Printer Wizard", "Do you want to print a test page?") Send("!o") Send("!N") WinWaitActive("Add Printer Wizard", "Completing the Add Printer Wizard") Send("{ENTER}") WinWaitClose("Add Printer Wizard", "Completing the Add Printer Wizard", 10) ElseIf ( (WinActive("Add Printer Wizard", "Another printer already has this name")) OR (WinActive("Add Printer Wizard", "Printer name conflict")) ) Then Send("{ENTER}") WinActivate("Add Printer Wizard", "name for this printer") WinWaitActive("Add Printer Wizard", "name for this printer") WinClose("Add Printer Wizard", "name for this printer") EndIf 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