Helen Posted October 17, 2012 Share Posted October 17, 2012 Hi All, I know I have to use an admin account to run this script, but for some reason it wont log or work It will work fine for the local machine, but when I try and get it to go through the servers, it wont log and I dont know if it works Thanks in advance for the help. Helen. expandcollapse popupGlobal $SLogPath = ("C:\SwInst\XENUptime.txt") ; This is the location of the logfile. It also adds the time and date with the _Filewritelog command. Keep as a global varible. Global $sName Global $sFilePath Global $sCommandline Global $fAllusers Global $iRunOnce Global $sSourcePath Global $sDestinationPath Global $sSourcePatha Global $sDestinationPatha Global $iFlag Global $CelLEMS Global $sReadfile Uptime1() Uptime2() End() DirCreate ("C:\Swinst") Func Uptime1() For $CelLEMS = 21 to 10 step -1 Local $sReadfile = FileExists("\\server" & $CelLEMS & "\c$\Windows\System32\kernel32.dll") If $sReadfile = 1 Then $ret = DllCall($sReadfile, "long", "GetTickCount") If IsArray($ret) Then $type = "Seconds" $uptime = Number(StringFormat("%.2f", $ret[0] / 1000)); convert miliseconds to seconds If $uptime > 60 Then $type = "Minute(s)" $uptime = Number(StringFormat("%.2f", $uptime / 60)); convert the seconds to minutes If $uptime > 60 Then $type = "Hour(s)" $uptime = Number(StringFormat("%.2f", $uptime / 60)); convert the minutes to hours If $uptime > 24 Then; convert hours to days $type = "Day(s)" $uptime = Number(StringFormat("%.2f", $uptime / 24)) $sLogMsg = "server" & $CelLEMS & " Uptime = " & $uptime & " " & $type _FileWriteLog($SLogPath, $sLogMsg, -1) EndIf EndIf EndIf EndIf Else $sLogMsg = "** server" & $CelLEMS & " Cannot Get info! **" _FileWriteLog($SLogPath, $sLogMsg, -1) EndIf Next EndFunc Func Uptime2() For $CelLEMS = 9 to 1 step -1 Local $sReadfile = FileExists("\\server" & $CelLEMS & "\c$\Windows\System32\kernel32.dll") If $sReadfile = 1 Then $ret = DllCall($sReadfile, "long", "GetTickCount") If IsArray($ret) Then $type = "Seconds" $uptime = Number(StringFormat("%.2f", $ret[0] / 1000)); convert miliseconds to seconds If $uptime > 60 Then $type = "Minute(s)" $uptime = Number(StringFormat("%.2f", $uptime / 60)); convert the seconds to minutes If $uptime > 60 Then $type = "Hour(s)" $uptime = Number(StringFormat("%.2f", $uptime / 60)); convert the minutes to hours If $uptime > 24 Then; convert hours to days $type = "Day(s)" $uptime = Number(StringFormat("%.2f", $uptime / 24)) $sLogMsg = "Server" & $CelLEMS & " Uptime = " & $uptime & " " & $type _FileWriteLog($SLogPath, $sLogMsg, -1) Else $sLogMsg = "** Server" & $CelLEMS & " Cannot Get info! **" _FileWriteLog($SLogPath, $sLogMsg, -1) EndIf EndIf EndIf EndIf EndIf Next EndFunc Func End() Exit EndFunc Link to comment Share on other sites More sharing options...
caleb41610 Posted October 17, 2012 Share Posted October 17, 2012 (edited) Well one tip, use >= instead of > for the conversions. > 60 = 61 or more >= 60 = 60 or more What OS is your local machine? What OS is the servers you are trying to run it on? and what does "i don't know if it works" mean? more info please. Edited October 17, 2012 by caleb41610 Multi-Connection TCP Server Link to comment Share on other sites More sharing options...
BrewManNH Posted October 17, 2012 Share Posted October 17, 2012 FileExists returns 1 or 0, not the name of the file, so your DLLCall is trying to run a DLLCall on the number 1 or 0 first of all. Second, you're running the DLLCall on the local machine, you may be trying to run the dllcall on the dll on the server, but it's going to get the local information because you're running it on the local machine if I'm not mistaken. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator 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