quasimodo Posted February 26, 2022 Share Posted February 26, 2022 I’m trying to run some of the example scripts from the Autoit help documentation. Most of the examples will stop with an error. e.g the UDF _Net_Share_StatisticsGetSvr(@ComputerName). I’m attaching a screen shot of the error output. This happens to several other _Net_Share scripts if a Server name is accessed, regardless if I enter a server name or not. What’s wrong? Hope somebody can give me a helping hand. Link to comment Share on other sites More sharing options...
quasimodo Posted February 26, 2022 Author Share Posted February 26, 2022 The purpose of my experiments is to find a quick and dirty Autoit function to see if there is an active network connection to my computer, e.g. like the PowerShell function “Get-smbsession” does . If anybody already knows of such a script, I would be grateful to know. Link to comment Share on other sites More sharing options...
Nine Posted February 26, 2022 Share Posted February 26, 2022 _WinAPI_IsInternetConnected() ? or _GetIP() ? “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
ad777 Posted February 26, 2022 Share Posted February 26, 2022 (edited) @quasimodo make sure you have the lastest Autoit Installed. This my NetShare UDF download below just put this file in \AutoIt3\Include\ ... NetShare.au3 Edited February 26, 2022 by ad777 iam ِAutoit programmer. best thing in life is to use your Brain to Achieve everything you want. Link to comment Share on other sites More sharing options...
quasimodo Posted March 1, 2022 Author Share Posted March 1, 2022 @ad777 Yes I had the latest version, I even tried with the latest beta and last but not least, I completely de- and reinstalled Autoit3. The results did not change at all. When I tried the example scripts form "_Net_Share_StatisticsGetWrk" and "_Net_Share_StatisticsGetSvr" I found, that the first script is working, the latter shows the old known error. So the question comes up: Does "_Net_Share_StatisticsGetSvr" require a server operating system like "Windows Server 20xx" ? All my computer in my little network are running WIN10 Pro, incl. my 'backup server'. Link to comment Share on other sites More sharing options...
ad777 Posted March 1, 2022 Share Posted March 1, 2022 (edited) 2 hours ago, quasimodo said: So the question comes up: Does "_Net_Share_StatisticsGetSvr" require a server operating system like "Windows Server 20xx" ? All my computer in my little network are running WIN10 Pro, incl. my 'backup server'. it Dosen't Require.info about _Net_Share_StatisticsGetSvr From microsoft: Minimum supported client Windows XP [desktop apps only] Minimum supported server Windows Server 2003 [desktop apps only] it Works Fine For Me,My Windows is 7 32bit. Edited March 1, 2022 by ad777 iam ِAutoit programmer. best thing in life is to use your Brain to Achieve everything you want. Link to comment Share on other sites More sharing options...
quasimodo Posted March 1, 2022 Author Share Posted March 1, 2022 Very strange! I ran the example scripts on 3 different computers. On two of them they failed, on the 3rd it was ok. This third one is a kind of 'backup' laptop for me. I used it for my normal work until I changed to a newer one. More or less the same SW is installed on both, the biggest difference is the HW, eg. an i7-8565U on the new and an I7-2630QM on the old one. I will test it in the next time by setting up the 'new' laptop with a new windows only. Will see what happens. Link to comment Share on other sites More sharing options...
ad777 Posted March 1, 2022 Share Posted March 1, 2022 (edited) @quasimodo What 3 different computers. you say's On two of them they failed, And other the 3rd it was ok: Question:What type of the two System that failed.& OsArch. &Question::What type of the System that not failed. As I say's My Sys:Win7 32bit and you say's:When I tried the example scripts form "_Net_Share_StatisticsGetWrk" and "_Net_Share_StatisticsGetSvr" I found, that the first script is working. so script from _Net_Share_StatisticsGetWrk:Worked. but _Net_Share_StatisticsGetSvr:not Worked. that imposibble. info about NetStatisticsGet From microsoft: Minimum supported client Windows XP [desktop apps only] Minimum supported server Windows Server 2003 [desktop apps only] they both have same system req,and this is Function script for both _Net_Share_StatisticsGetWrk,_Net_Share_StatisticsGetSvr: expandcollapse popupFunc _Net_Share_StatisticsGetSvr($sServer = "") Local $aStats[15] Local $tService = _WinAPI_MultiByteToWideChar("LanmanServer") Local $aResult = DllCall("netapi32.dll", "int", "NetStatisticsGet", "wstr", $sServer, "struct*", $tService, "dword", 0, "dword", 0, "ptr*", 0) If @error Then Return SetError(@error, @extended, 0) If $aResult[0] Then Return SetError(10, $aResult[0], 0) Local $tStatInfo = DllStructCreate($tagSTAT_SERVER_0, $aResult[5]) $aStats[0] = DllStructGetData($tStatInfo, "Start") $aStats[1] = DllStructGetData($tStatInfo, "FOpens") $aStats[2] = DllStructGetData($tStatInfo, "DevOpens") $aStats[3] = DllStructGetData($tStatInfo, "JobsQueued") $aStats[4] = DllStructGetData($tStatInfo, "SOpens") $aStats[5] = DllStructGetData($tStatInfo, "STimedOut") $aStats[6] = DllStructGetData($tStatInfo, "SErrorOut") $aStats[7] = DllStructGetData($tStatInfo, "PWErrors") $aStats[8] = DllStructGetData($tStatInfo, "PermErrors") $aStats[9] = DllStructGetData($tStatInfo, "SysErrors") $aStats[10] = DllStructGetData($tStatInfo, "ByteSent") $aStats[11] = DllStructGetData($tStatInfo, "ByteRecv") $aStats[12] = DllStructGetData($tStatInfo, "AvResponse") $aStats[13] = DllStructGetData($tStatInfo, "ReqBufNeed") $aStats[14] = DllStructGetData($tStatInfo, "BigBufNeed") __Net_Share_APIBufferFree($aResult[5]) Return $aStats EndFunc ;==>_Net_Share_StatisticsGetSvr ; #FUNCTION# ==================================================================================================================== ; Author ........: Paul Campbell (PaulIA) ; Modified.......: ; =============================================================================================================================== Func _Net_Share_StatisticsGetWrk($sWorkStation = "") Local $aStats[40] Local $tService = _WinAPI_MultiByteToWideChar("LanmanWorkstation") Local $aResult = DllCall("netapi32.dll", "int", "NetStatisticsGet", "wstr", $sWorkStation, "struct*", $tService, "dword", 0, "dword", 0, "ptr*", 0) If @error Then Return SetError(@error, @extended, 0) If $aResult[0] Then Return SetError(10, $aResult[0], 0) Local $tStatInfo = DllStructCreate($tagSTAT_WORKSTATION_0, $aResult[5]) $aStats[0] = DllStructGetData($tStatInfo, "StartTime") $aStats[1] = DllStructGetData($tStatInfo, "BytesRecv") $aStats[2] = DllStructGetData($tStatInfo, "SMBSRecv") $aStats[3] = DllStructGetData($tStatInfo, "PageRead") $aStats[4] = DllStructGetData($tStatInfo, "NonPageRead") $aStats[5] = DllStructGetData($tStatInfo, "CacheRead") $aStats[6] = DllStructGetData($tStatInfo, "NetRead") $aStats[7] = DllStructGetData($tStatInfo, "BytesTran") $aStats[8] = DllStructGetData($tStatInfo, "SMBSTran") $aStats[9] = DllStructGetData($tStatInfo, "PageWrite") $aStats[10] = DllStructGetData($tStatInfo, "NonPageWrite") $aStats[11] = DllStructGetData($tStatInfo, "CacheWrite") $aStats[12] = DllStructGetData($tStatInfo, "NetWrite") $aStats[13] = DllStructGetData($tStatInfo, "InitFailed") $aStats[14] = DllStructGetData($tStatInfo, "FailedComp") $aStats[15] = DllStructGetData($tStatInfo, "ReadOp") $aStats[16] = DllStructGetData($tStatInfo, "RandomReadOp") $aStats[17] = DllStructGetData($tStatInfo, "ReadSMBS") $aStats[18] = DllStructGetData($tStatInfo, "LargeReadSMBS") $aStats[19] = DllStructGetData($tStatInfo, "SmallReadSMBS") $aStats[20] = DllStructGetData($tStatInfo, "WriteOp") $aStats[21] = DllStructGetData($tStatInfo, "RandomWriteOp") $aStats[22] = DllStructGetData($tStatInfo, "WriteSMBS") $aStats[23] = DllStructGetData($tStatInfo, "LargeWriteSMBS") $aStats[24] = DllStructGetData($tStatInfo, "SmallWriteSMBS") $aStats[25] = DllStructGetData($tStatInfo, "RawReadsDenied") $aStats[26] = DllStructGetData($tStatInfo, "RawWritesDenied") $aStats[27] = DllStructGetData($tStatInfo, "NetworkErrors") $aStats[28] = DllStructGetData($tStatInfo, "Sessions") $aStats[29] = DllStructGetData($tStatInfo, "FailedSessions") $aStats[30] = DllStructGetData($tStatInfo, "Reconnects") $aStats[31] = DllStructGetData($tStatInfo, "CoreConnects") $aStats[32] = DllStructGetData($tStatInfo, "LM20Connects") $aStats[33] = DllStructGetData($tStatInfo, "LM21Connects") $aStats[34] = DllStructGetData($tStatInfo, "LMNTConnects") $aStats[35] = DllStructGetData($tStatInfo, "ServerDisconnects") $aStats[36] = DllStructGetData($tStatInfo, "HungSessions") $aStats[37] = DllStructGetData($tStatInfo, "UseCount") $aStats[38] = DllStructGetData($tStatInfo, "FailedUseCount") $aStats[39] = DllStructGetData($tStatInfo, "CurrentCommands") __Net_Share_APIBufferFree($aResult[5]) Return $aStats EndFunc ;==>_Net_Share_StatisticsGetWrk it should not give you error.. Edited March 1, 2022 by ad777 iam ِAutoit programmer. best thing in life is to use your Brain to Achieve everything you want. Link to comment Share on other sites More sharing options...
quasimodo Posted March 2, 2022 Author Share Posted March 2, 2022 I think, that I'm on the right track: As I mentioned, on my old laptop with more or less the same SW installation, no error occurred. So I deinstalled one program after the other from my new computer with the exception of Autoit3. This did not help in any way. Finally I installed a quite new Windows plus Autoit3 on my new computer and , o wonder, everything is fine. This brings me to the conclusion, that I probably installed some registry tweaks which hamper the mentioned scripts to function properly. I'm going to set up my new computer step by step during the next weeks and check when the error pops up again. I will report. Link to comment Share on other sites More sharing options...
Solution quasimodo Posted March 7, 2022 Author Solution Share Posted March 7, 2022 Hi, problem not discovered, but not existing anymore! It is very, very strange. As I mentioned before, the scripts did not run even when I deleted all and every other SW from my computer, but did run when I set up my windows from scratch. The last I checked by installing a new 512GB disk into my laptop. Originally and normally I have a 2 TB disk installed, partitioned in 192 GB C-drive the rest as drive D. I formatted drive C and installed a new Window on that partition. This did not help either, the error still was shown. After that I formatted the whole 2 TB disk, and build a new Windows on it. Now everything was fine and I could partition it again and restore my whole disk D. Finally I manually installed all my previous programs on drive C and found, that everything is working perfectly. So I really don't know, where the error resided, if on disk C or in the boot partition. It cost me many many working hours but I'm happy, that the hidden error now disappeared. On the other hand it turned out, that the _net_share functions which showed the trouble will not help me in solving my scripts. So I have to build my own function to address a special MS PowerShell Comlet. Thanks to everybody for their help. Link to comment Share on other sites More sharing options...
quasimodo Posted March 8, 2022 Author Share Posted March 8, 2022 Supplement The error I mentioned in previous posts I discovered on two of my 4 PC's. By completely new formatting the disk and setting up a brand new Windows on one of these PCs the error disappeared. Not so on the last one. This last PC is a HP ProLiant MicroServer Gen8. I tried to format the OS-disk with MBR or GPT and put it on different slots. Nothing helped. The error is still present. (Took me another 6 h or more fiddling around.) So the question still comes up: What really causes the error? Since I cannot use the _Net_Share functions anyhow, I'm not going to find it out. 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