jguinch Posted October 15, 2014 Author Share Posted October 15, 2014 spudw2k : i thought about adding a $remotecomputer parameter, but it will be limited to only some functions (as you said). I preferred not to do, to be consistent in all functions. Now, if it can be useful to someone, I will. The flushdns could be affected to, maybe with Win32_Process and the Create() method. Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to comment Share on other sites More sharing options...
spudw2k Posted October 15, 2014 Share Posted October 15, 2014 (edited) If I were to do it I would add an optional $computer paramter as the last param to the "remote" functions and modify the WMI call and REG funcs to use it. Func _GetNetworkAdapterInfos($sNetAdapter = "", $sComputer = @ComputerName) Local $objWMIService = ObjGet("winmgmts:\\" & $sComputer & "\root\CIMV2") Func _GetNetworkAdapterList($sComputer = @ComputerName) ... $sGuid = RegEnumKey("\\" & $sComputer & "\HKLM\SYSTEM\CurrentControlSet\services\Tcpip\Parameters\Interfaces", $i) etc... edit: As far as performing the _FlushDNS using WMI (Win32_Process.Create), I haven't used that is a long time and am not thinking of an easy way to retrieve some sort of return code for sucess or failure. Might not be that important as the expected results from a DNS Flush are pretty clear cut and dry, but just from a good coding perspective some validation is always preferred. Edited October 15, 2014 by spudw2k Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
colombeen Posted November 29, 2014 Share Posted November 29, 2014 you could do flushdns on a remote computer with psexec or something... not as nice as pure code but it works Link to comment Share on other sites More sharing options...
jguinch Posted March 16, 2016 Author Share Posted March 16, 2016 (edited) Added : _FlushDNSEntry (removes the specified entry from the DNS cache) Edited December 19, 2016 by jguinch GuyFromNJo 1 Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to comment Share on other sites More sharing options...
StevenFJSmith Posted January 19, 2017 Share Posted January 19, 2017 Hi jguinch, thanks for a very useful UDF library. I think I've found an issue with the _GetNetworkInfos function. When I tried it on Windows 7 Prof 64bit & Windows 10 Prof. 64 bit, I got a COM error on line 457, which contains: $aInfos[$n - 1][22] = _Array2String( ($objNetAdapterConfig.DNSDomainSuffixSearch) , ",") According to https://msdn.microsoft.com/en-us/library/aa394217(v=vs.85).aspx, the property is : string DNSDomainSuffixSearchOrder[]; Changing the line to $aInfos[$n - 1][22] = _Array2String( ($objNetAdapterConfig.DNSDomainSuffixSearchOrder) , ",") made it work for me. Link to comment Share on other sites More sharing options...
jguinch Posted January 19, 2017 Author Share Posted January 19, 2017 Thanks @StevenFJSmith for pointing out this issue. I don't know where the "Order" was left File edited. Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to comment Share on other sites More sharing options...
careca Posted February 3, 2017 Share Posted February 3, 2017 Just want to say this is nice, all i had to do was coment out the arraydisplay, else it would show every time, and i didnt need that. Thanks for UDF. Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe Link to comment Share on other sites More sharing options...
jguinch Posted February 3, 2017 Author Share Posted February 3, 2017 Thanks careca. _ArrayDisplay removed Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to comment Share on other sites More sharing options...
antonioj84 Posted April 5, 2017 Share Posted April 5, 2017 (edited) There are 3 area that did not work for me adding DNS, WINS and WINS Suffixes. I am using win7. I can easily do that at the dos prompt Edited April 5, 2017 by antonioj84 update Link to comment Share on other sites More sharing options...
careca Posted April 16, 2017 Share Posted April 16, 2017 Example of what works for me: #RequireAdmin #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=dns.ico #AutoIt3Wrapper_Res_Icon_Add=dns.ico #pragma compile(UPX, false) #pragma compile(ProductVersion, 1.0) #pragma compile(FileVersion, 1.0) #pragma compile(x64, false) #AutoIt3Wrapper_UseUpx=n #AutoIt3Wrapper_Res_SaveSource=y #AutoIt3Wrapper_UseX64=n #AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w- 7 #AutoIt3Wrapper_Run_Tidy=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include 'AutoItConstants.au3' #include "network.au3" FileInstall("dns.ico", @TempDir & "\dns.ico", 1) FileInstall("dns.au3", @TempDir & "\dns.au3", 1) FileInstall("network.au3", @TempDir & "\network.au3", 1) Local $infos = _GetNetworkAdapterList() ;MsgBox(64, '', $infos[1][1]) Run('netsh dnsclient add dnsservers name="' & $infos[1][1] & '" address=8.8.8.8 index=1 validate=yes', '', @SW_HIDE) Run('netsh dnsclient add dnsservers name="' & $infos[1][1] & '" address=8.8.4.4 index=2 validate=yes', '', @SW_HIDE) Exit antonioj84 1 Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe Link to comment Share on other sites More sharing options...
antonioj84 Posted April 17, 2017 Share Posted April 17, 2017 thanks i got mine workinghttps://www.autoitscript.com/forum/topic/151916-regwritewill-not-write-to-hklm-tried-all-standard-solutions/#comment-1349366 Link to comment Share on other sites More sharing options...
jguinch Posted April 24, 2017 Author Share Posted April 24, 2017 @antonioj84 : can you provide the AutoIt code you used to add DNS, WINS and WINS Suffixes ? Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to comment Share on other sites More sharing options...
antonioj84 Posted June 20, 2017 Share Posted June 20, 2017 (edited) sorry for the late response for windows 10 change "Local Area Connection" to "Ethernet", let me know when you will update the UDF Func AddStaticIPInfo($NewIP, $Gateaway) Local $subnetMask = "255.255.255.192", $DnsPrimary = "10.1.246.40", $DnsSecondary = "10.224.41.40" Local $WinsPrimary = " 10.1.40.68", $WinsSecondary = "10.224.40.68" RunWait('netsh interface ipv4 set address name="Local Area Connection" source=static address=' & $NewIP & ' mask=' & $subnetMask & ' gateway=' & $Gateaway, "", @SW_HIDE) ; gwmetric=1 ConsoleWrite("newIPtest" & $NewIP) RunWait('netsh interface ip set dns name= "Local Area Connection" source="static" address= ' & $DnsPrimary, "", @SW_HIDE) RunWait('netsh interface ip add dns name="Local Area Connection" index=2 addr=' & $DnsSecondary, "", @SW_HIDE) RegWrite($sHKLMRoot & '\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters', 'SearchList', 'REG_SZ', 'yahoo.com,amazon.com,google.com') ;~RunWait(@Comspec & ' /c Reg Add HKLM\system\currentcontrolset\services\tcpip\parameters /v "SearchList" /d "domain1.com,domain2.com" /f') RunWait('netsh interface ip set winsservers name= "Local Area Connection" source="static" address= ' & $WinsPrimary, "", @SW_HIDE) RunWait('netsh interface ip add winsservers name="Local Area Connection" index=2 addr=' & $WinsSecondary, "", @SW_HIDE) EndIf endfunc Edited June 20, 2017 by antonioj84 error Link to comment Share on other sites More sharing options...
jguinch Posted June 27, 2017 Author Share Posted June 27, 2017 new version updated : - _SetDNSSuffixSearchOrder didn't work, fixed now Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to comment Share on other sites More sharing options...
jguinch Posted June 27, 2017 Author Share Posted June 27, 2017 @antonioj84 : for my question in #32 : On 05/04/2017 at 7:26 PM, antonioj84 said: There are 3 area that did not work for me adding DNS, WINS and WINS Suffixes. My question was : Can you post the code you used with my UDF for this ? I cannot reproduce the issue. Are you sure you used #RequireAdmin at the top of the script ? Also, there is no function to add Wins suffixes, you meant DNS Suffixes ? You can do it with _SetDNSSuffixSearchOrder (fixed now) Example : #RequireAdmin #Include "Network.au3" Local $aDns = ["192.168.1.10", "192.168.1.11"] Local $aDnsDomains = ["mydomain.local", "myotherdomain.local"] Local $sAdapter = "Local Area Connection" _SetDNSServerSearchOrder($sAdapter, $aDns) _SetDNSSuffixSearchOrder($aDnsDomains) Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to comment Share on other sites More sharing options...
antonioj84 Posted June 27, 2017 Share Posted June 27, 2017 (edited) RunWait('netsh interface ip set winsservers name= "Local Area Connection" source="static" address= ' & $WinsPrimary, "", @SW_HIDE) RunWait('netsh interface ip add winsservers name="Local Area Connection" index=2 addr=' & $WinsSecondary, "", @SW_HIDE) @jguinch I did not use your UDF per say, however I took some of your ideas, what I was looking for was suffixes , dns and wins. The code I posted above showed how to do that. I use "#requireAdmin" Thanks for making the changes and the update on your UDF. I will use your UDF in the future. see the link Edited June 27, 2017 by antonioj84 ok Link to comment Share on other sites More sharing options...
antonioj84 Posted June 27, 2017 Share Posted June 27, 2017 @ @jguinch about your print udf I basically want to check if a printer exist then change the Current IP address to a new IP address can I do this ? if _printmgrPrinterExist("myprinter") then _PrintMgr_RemoveTCPIPPrinterPort("192.123.114.14") _PrintMgr_AddTCPIPPrinterPort("10.229.114.1) endif if _printmgrPrinterExist("myprinter") then _printMgr_SetPrinterPort("10.229.114.1) endif Link to comment Share on other sites More sharing options...
antonioj84 Posted June 27, 2017 Share Posted June 27, 2017 (edited) @ jguinch You may consider adding hostname , workgroup , description to make it complete Func AddPOSname($computer) $name = $sComputerName $sWorkGroup = "WORKGROUP" $CMD = 'net config server /srvcomment:"' RegWrite($sHKLMRoot & "\SYSTEM\CurrentControlSet\Control\ComputerName\ActiveComputerName", "ComputerName", "REG_SZ", StringUpper($name)) RegWrite($sHKLMRoot & "\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName", "ComputerName", "REG_SZ", StringUpper($name)) RegWrite($sHKLMRoot & "\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters", "Hostname", "REG_SZ", StringUpper($name)) RegWrite($sHKLMRoot & "\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters", "NV Hostname", "REG_SZ", StringUpper($name)) RunWait(@ComSpec & " /c " & $CMD & StringUpper($name), "", "", @SW_HIDE) ; adding computer description name If @OSArch = "x64" Then DllCall("kernel32.dll", "boolean", "Wow64DisableWow64FsRedirection", "boolean", 1) ;~ Turns On 64 Bit Redirection RunWait('PowerShell.exe -Command "& {Add-Computer -WorkGroupName "' & StringUpper($sWorkGroup) & '"}"', "", @SW_HIDE) ; adding to workgroup DllCall("kernel32.dll", "boolean", "Wow64DisableWow64FsRedirection", "boolean", 0) ;~ Turns Off 64 Bit Redirection Else RunWait('PowerShell.exe -Command "& {Add-Computer -WorkGroupName "' & StringUpper($sWorkGroup) & '"}"', "", @SW_HIDE) ; adding to workgroup EndIf EndFunc ;==>Addhostname Edited June 28, 2017 by antonioj84 ok Link to comment Share on other sites More sharing options...
jguinch Posted June 28, 2017 Author Share Posted June 28, 2017 @antonioj84 : for the Printer UDF, please post the message in the good topic, it has no sense here. 8 hours ago, antonioj84 said: I did not use your UDF per say, however I took some of your ideas, what I was looking for was suffixes , dns and wins. The code I posted above showed how to do that. I use "#requireAdmin" Ok, so you didn't try it, and you say it doesn't work ??? 7 hours ago, antonioj84 said: You may consider adding hostname , workgroup , description to make it complete No, I do not consider it. It's a network configuration UDF, that's all. Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to comment Share on other sites More sharing options...
benched42 Posted June 28, 2017 Share Posted June 28, 2017 First off, thank you for a very nice UDF. I am trying to incorporate it into a script that displays a lot of information about the machine for use in our helpdesk information gathering for trouble tickets. I do have a question, though. Why is it that when I use the _GetNetworkAdapterInfos() that I only get a return on the active NIC? As an example, I have a wireless and wired NICs as well as a VPN adapter and bluetooth adapter listed when I perform _GetNetworkAdapterList(). But when I run the _GetNetworkAdapterInfos() immediately afterward, as in your default demonstration script, it only shows the information for my wireless NIC, which is active. It does not show any information on any other network devices. I should still be able to get MAC addresses, shouldn't I? I know there are other ways to do this but just curious why it only shows the active device. I am running Windows 10 Enterprise 64 bit on a Lenovo W530. Who lied and told you life would EVER be fair? 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