Provogeek Posted October 3, 2006 Share Posted October 3, 2006 I want to use AutoIT to execute the Kiwi Syslog client tool to send messages to a syslog server that will first obtain the workstations name, then include what ever message I pass to it when I excute the script.I am dealing with a 1200+ PC WAN that I need to get reports on everytime I deploy an update or application to the PC. I have bandwidth limits (160 stores, 256k each store to the data center) and I am being instructed to make any deployment as small as possible (and to make the transfer of knowledge as easy as possible since I am an intergrator and will not be around to maintain the system). The built in reporting included with the deployment software does not satisfy my customer and he has asked me to use Syslog since it provides him with a simple text file to work with (deployment software uses a Sybase database that he does not want to deal with).The Kiwi syslog server can do resolution for the IP address to provide workstation name, but the WAN admin will not provide DNS updates fom DHCP since the IP address lease time is very small and workstations change their IP address many times through out the week (again, conserving bandwidth by not linking DHCP with DNS). To get an acurate report of what workstation has gotten what update/application, I am using AutoIT to grab the workstation name, then execute the Kiwi Syslog client placing the workstation name into the message it sends along with what ever it was that was acomplished. I do not want to have to provide my customer with a script for every deployment to get a descriptive message to make the log viewing simplified and allow for cross deployments to occure. I would like to deploy a single script that I can simply callReport.exe /m "Update KB012375 Complete"And for the Syslog message to pop up on the server saying "0999WS02 Update KB012375 Complete"then for the next deploymentReport.exe /m "Java 1.(what ever) installed"And for the Syslog message to pop on the server saying "0999WS02 Java 1.(what ever) installed"So that when ever I need to make a syslog message, I am not deploying the script every time, just executing and sending a command line argument to tell it what message I want it to pass along.thank you Link to comment Share on other sites More sharing options...
PsaltyDS Posted October 3, 2006 Share Posted October 3, 2006 I want to use AutoIT to execute the Kiwi Syslog client tool to send messages to a syslog server that will first obtain the workstations name, then include what ever message I pass to it when I excute the script. I am dealing with a 1200+ PC WAN that I need to get reports on everytime I deploy an update or application to the PC. I have bandwidth limits (160 stores, 256k each store to the data center) and I am being instructed to make any deployment as small as possible (and to make the transfer of knowledge as easy as possible since I am an intergrator and will not be around to maintain the system). The built in reporting included with the deployment software does not satisfy my customer and he has asked me to use Syslog since it provides him with a simple text file to work with (deployment software uses a Sybase database that he does not want to deal with). The Kiwi syslog server can do resolution for the IP address to provide workstation name, but the WAN admin will not provide DNS updates fom DHCP since the IP address lease time is very small and workstations change their IP address many times through out the week (again, conserving bandwidth by not linking DHCP with DNS). To get an acurate report of what workstation has gotten what update/application, I am using AutoIT to grab the workstation name, then execute the Kiwi Syslog client placing the workstation name into the message it sends along with what ever it was that was acomplished. I do not want to have to provide my customer with a script for every deployment to get a descriptive message to make the log viewing simplified and allow for cross deployments to occure. I would like to deploy a single script that I can simply call Report.exe /m "Update KB012375 Complete" And for the Syslog message to pop up on the server saying "0999WS02 Update KB012375 Complete" then for the next deployment Report.exe /m "Java 1.(what ever) installed" And for the Syslog message to pop on the server saying "0999WS02 Java 1.(what ever) installed" So that when ever I need to make a syslog message, I am not deploying the script every time, just executing and sending a command line argument to tell it what message I want it to pass along. thank you Did you checkout the helpfile on Commandline parameters? Are you already comfortable with AutoIT arrays? If the answer to both is yes, you are home free. If not, please be more specific on what you need help with. The executive summary is that all the parameters passed to a script on the commandline are passed to the script via an array called $CmdLine, where the first element ($CmdLine[0]) contains the number of parameters and the following elements ($CmdLine[1] thru $CmdLine[n]) contain the acutal parameters. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Provogeek Posted October 3, 2006 Author Share Posted October 3, 2006 Did you checkout the helpfile on Commandline parameters? Are you already comfortable with AutoIT arrays? If the answer to both is yes, you are home free. If not, please be more specific on what you need help with. The executive summary is that all the parameters passed to a script on the commandline are passed to the script via an array called $CmdLine, where the first element ($CmdLine[0]) contains the number of parameters and the following elements ($CmdLine[1] thru $CmdLine[n]) contain the acutal parameters. Thank you PsaltyDS. When I searched the help file I did not find this when I was trying to figure out how to do this. Now I just need to wrap my head around it. thank you for the pointer. Link to comment Share on other sites More sharing options...
Provogeek Posted October 3, 2006 Author Share Posted October 3, 2006 Well that was easier than I thought, just a single line too RunWait("klogwin.exe -u <port> -h <ipaddress> -l 4 -F user -L notice -m " & '"' & @ComputerName & " " & $CmdLineRaw & '"') Does exactly what I was looking for, send the PC name along with what ever message I want taged after it. thanks again PsaltyDS Link to comment Share on other sites More sharing options...
Developers Jos Posted October 3, 2006 Developers Share Posted October 3, 2006 Now I just need to wrap my head around it. thank you for the pointer. here is an example how you could process the commandline parameters: ; retrieve commandline parameters Dim $Batch = 0 Dim $install = 0 Dim $Server = "" Dim $V_Arg = "Valid Arguments are:" & @LF $V_Arg &= " /batch - don't prompt for anything.. fail is something is missing." & @LF $V_Arg &= " /install - Install the Client and Update Registry." & @LF $V_Arg &= " /s NAME - Target Server." & @LF For $x = 1 to $CmdLine[0] Select Case $CmdLine[$x] = "/batch" $Batch = 1 Case $CmdLine[$x] = "/install" $install = 1 Case $CmdLine[$x] = "/s" $x = $x + 1 $Server = $CmdLine[$x] Case Else MsgBox( 1, "Demo", "Wrong commandline argument: " & $CmdLine[$x] & @LF & $v_Arg) Exit EndSelect Next SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
PsaltyDS Posted October 3, 2006 Share Posted October 3, 2006 (edited) Well that was easier than I thought, just a single line too RunWait("klogwin.exe -u <port> -h <ipaddress> -l 4 -F user -L notice -m " & '"' & @ComputerName & " " & $CmdLineRaw & '"') Does exactly what I was looking for, send the PC name along with what ever message I want taged after it. thanks again PsaltyDS DANGER! Danger, Will Robinson!!! $CmdLineRaw gives unreliable results, and is depricated in favor of the $CmdLine array. You may be introducing an unstable element to your script by doing it that way... Edited October 3, 2006 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Developers Jos Posted October 3, 2006 Developers Share Posted October 3, 2006 (edited) $CmdLineRaw gives unreliable results, and is depricated in favor of the $CmdLine array. You may be introducing an unstable element to your script by doing it that way... $CmdLineRaw was added later and wasn't depreciated in favor of.... 4th Aug, 2004 - v3.0.102Added: Predefined $CmdLineRaw variable now holds the original command line in full Edited October 3, 2006 by JdeB SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
PsaltyDS Posted October 3, 2006 Share Posted October 3, 2006 $CmdLineRaw was added later and wasn't depreciated in favor of....My mistake, bad use of a two-bit word: "deprecated". I'm not a programmer, so I wasn't supposed to be able to check that word out of the library anyway! :"> However, the point remains. Is $CmdLineRaw not considered much less reliable in use, because the results change based on how the script is run? I had a discussion on this before with MHz, and he schooled me on how the $CmdLine array was consistent, but the $CmdLineRaw was not. It appeared $CmdLineRaw was more of interest for debug use, and $CmdLine array should be used generaly. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law 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