ant2ne Posted September 18, 2012 Share Posted September 18, 2012 (edited) On a Windows 2008 Small Business Server. (Actually Winodws Server Standard FE SP2). I'm having a smilar issue on a SBS 2003. But I haven't installed scite on that one. Error... >"C:Program Files (x86)AutoIt3SciTE..autoit3.exe" /ErrorStdOut "C:SysInfott_SystemStatusGatherer.au3" C:SysInfott_SystemStatusGatherer.au3 (324) : ==> The requested action with this object has failed.: $objMessage.Subject = "Report for: " & @LogonDomain & " " & @COMPUTERNAME $objMessage.Subject = "Report for: " & @LogonDomain & " " & @COMPUTERNAME^ ERROR >Exit code: 1 Time: 2.518 Section of code in question.... $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc") $objMessage = ObjCreate ("CDO.Message") With $objMessage .Subject = "Report for: " & @LogonDomain & " " & @COMPUTERNAME .Sender = "monitor@blah.com" .From = "monitor@blah.com" .To = "blah@blah.com" .TextBody = $body & @CRLF & @CRLF & "Do not reply to this email" EndWith With $objMessage.Configuration.Fields .Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 .Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mail.server.com" ; <== SMTP SERVER .Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 .Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = "monitor+server.com" ; <== SMTP USERNAME .Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "PASSWORD" ; <== SMTP PASSWORD .Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 .Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60 .Update EndWith $objMessage.Send exit I tried changing the code to this... $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc") $objMessage = ObjCreate ("CDO.Message") ;With $objMessage $objMessage.Subject = "Report for: " & @LogonDomain & " " & @COMPUTERNAME $objMessage.Sender = "monitor@blah.com" $objMessage.From = "monitor@blah.com" $objMessage.To = "blah@blah.com" $objMessage.TextBody = $body & @CRLF & @CRLF & "Do not reply to this email" EndWith With $objMessage.Configuration.Fields .Item ("[url="http://schemas.microsoft.com/cdo/configuration/sendusing"]http://schemas.microsoft.com/cdo/configuration/sendusing"[/url]) = 2 .Item ("[url="http://schemas.microsoft.com/cdo/configuration/smtpserver"]http://schemas.microsoft.com/cdo/configuration/smtpserver"[/url]) = "mail.mccls.com" ; <== SMTP SERVER .Item ("[url="http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"]http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"[/url]) = 1 .Item ("[url="http://schemas.microsoft.com/cdo/configuration/sendusername"]http://schemas.microsoft.com/cdo/configuration/sendusername"[/url]) = "monitor+mccls.com" ; <== SMTP USERNAME .Item ("[url="http://schemas.microsoft.com/cdo/configuration/sendpassword"]http://schemas.microsoft.com/cdo/configuration/sendpassword"[/url]) = "m0nitor" ; <== SMTP PASSWORD .Item ("[url="http://schemas.microsoft.com/cdo/configuration/smtpserverport"]http://schemas.microsoft.com/cdo/configuration/smtpserverport"[/url]) = 25 .Item ("[url="http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout"]http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout"[/url]) = 60 .Update EndWith $objMessage.Send exit But it didn't help any. This code is working just fine on a few standard edition servers. ie. not Small Business Servers. Ideas? Suggestions? Edited September 19, 2012 by ant2ne Link to comment Share on other sites More sharing options...
Tripredacus Posted September 19, 2012 Share Posted September 19, 2012 First suggestion... change from tags to [autoit] tags... Build a MsgBox to test what data @ComputerName has in it on the target OS. Twitter | MSFN | VGCollect Link to comment Share on other sites More sharing options...
BrewManNH Posted September 19, 2012 Share Posted September 19, 2012 Your first With statement is commented out. 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...
ant2ne Posted September 19, 2012 Author Share Posted September 19, 2012 (edited) Your first With statement is commented out.Ooops... that commenting out was part of my troubleshooting, which I did before copying the code and pasting it here. I just now double checked and verified that the problem persists when uncommented. Edited September 19, 2012 by ant2ne Link to comment Share on other sites More sharing options...
ant2ne Posted September 19, 2012 Author Share Posted September 19, 2012 (edited) First suggestion... change from tags to [autoit] tags... Build a MsgBox to test what data @ComputerName has in it on the target OS. changed code to autoit. The problem machine returns RLSSERVER as @COMPUTERNAME. Which is its computer name. I also noticed that if I comment out the entire ".Subject =" line, I then get a similar error but on the next uncommented line. Edited September 19, 2012 by ant2ne Link to comment Share on other sites More sharing options...
BrewManNH Posted September 19, 2012 Share Posted September 19, 2012 Is it possible that CDO isn't installed on the 2008 server? It's not installed by default. 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...
Tripredacus Posted September 20, 2012 Share Posted September 20, 2012 (edited) Ok first of all, in the "Subject" part you tried commenting out, you are missing the trailing " And second... Before trying to get this to work (and I imagine you didn't post the full code). run this through SyntaxCheckProd (or Beta) first to make sure AutoIT is cool with everything. I get the following: >"C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /prod /AU3Check /in "F:Sourcesyntax.au3" +>11:03:02 Starting AutoIt3Wrapper v.2.0.1.24 Environment(Language:0409 Keyboard:00000409 OS:WIN_7/Service Pack 1 CPU:X64 OS:X86) >Running AU3Check (1.54.19.0) from:C:Program FilesAutoIt3 F:SourceWinPEImagexPE3x64testsyntax.au3(8,30) : WARNING: $body: possibly used before declaration. $objMessage.TextBody = $body & ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ F:SourceWinPEImagexPE3x64testsyntax.au3(12,15) : ERROR: syntax error .Item ("[url="http ~~~~~~~~~~~~~~^ F:SourceWinPEImagexPE3x64testsyntax.au3(13,15) : ERROR: syntax error (illegal character) .Item ("[url="http ~~~~~~~~~~~~~~^ F:SourceWinPEImagexPE3x64testsyntax.au3(14,15) : ERROR: syntax error (illegal character) .Item ("[url="http ~~~~~~~~~~~~~~^ F:SourceWinPEImagexPE3x64testsyntax.au3(15,15) : ERROR: syntax error (illegal character) .Item ("[url="http ~~~~~~~~~~~~~~^ F:SourceWinPEImagexPE3x64testsyntax.au3(16,15) : ERROR: syntax error (illegal character) .Item ("[url="http ~~~~~~~~~~~~~~^ F:SourceWinPEImagexPE3x64testsyntax.au3(17,15) : ERROR: syntax error (illegal character) .Item ("[url="http ~~~~~~~~~~~~~~^ F:SourceWinPEImagexPE3x64testsyntax.au3(18,15) : ERROR: syntax error (illegal character) .Item ("[url="http ~~~~~~~~~~~~~~^ F:SourceWinPEImagexPE3x64testsyntax.au3(8,30) : ERROR: $body: undeclared global variable. $objMessage.TextBody = $body & ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ F:SourceWinPEImagexPE3x64testsyntax.au3 - 8 error(s), 1 warning(s) !>11:03:02 AU3Check ended.rc:2 >Exit code: 0 Time: 0.434 Edited September 20, 2012 by Tripredacus Twitter | MSFN | VGCollect Link to comment Share on other sites More sharing options...
ant2ne Posted September 21, 2012 Author Share Posted September 21, 2012 What is CDO? Could you be more specific regarding the trailing "? I don't see anyplace where I missed a ". .Subject = "Report for: " & @LogonDomain & " " & @COMPUTERNAME In order to run that stretch of code you will need to include #include <Inet.au3> at the top. Link to comment Share on other sites More sharing options...
Tripredacus Posted September 21, 2012 Share Posted September 21, 2012 What is CDO? Could you be more specific regarding the trailing "? I don't see anyplace where I missed a ". .Subject = "Report for: " & @LogonDomain & " " & @COMPUTERNAME In order to run that stretch of code you will need to include #include <Inet.au3> at the top. Here is CDO overview. http://msdn.microsoft.com/en-us/library/aa140862%28office.10%29.aspx Basically, your code is attempting to send an email through CDO, but if you don't have it installed/enabled, your app won't work. Even with that include, it doesn't pass syntax check. Did you run it yourself? The problem I am seeing with the .Subject is that it your line output ends up being: "Report for: " DOMAIN "" COMPUTER But the end of the line isn't wrapped. Shouldn't you use something like this instead? $objMessage.Subject = Chr(34) & "Report for: " & @LogonDomain & " " & @COMPUTERNAME & Chr(34) See because I see the other objects you have everything encapsulated except for Subject. I'm not sure if that matters but it doesn't look right to me. Even so, SyntaxCheckProd doesn't seem to like the use of quotes in the .Item lines. Twitter | MSFN | VGCollect Link to comment Share on other sites More sharing options...
ant2ne Posted September 21, 2012 Author Share Posted September 21, 2012 Lets not forget, this code runs pefectly fine on my workstation, and 4 of 6 servers. I don't know how it could be syntax issue. The two with this error are SBS servers, one 2003 and one 2008. Both have functional exchange servers so I can'e see how CDO would be the issue. With $objMessage.Subject = Chr(34) & "Report for: " & @LogonDomain & " " & @COMPUTERNAME & Chr(34) I still get >"C:Program Files (x86)AutoIt3SciTE..autoit3.exe" /ErrorStdOut "C:SysInfott_SystemStatusGatherer.au3" C:SysInfott_SystemStatusGatherer.au3 (323) : ==> The requested action with this object has failed.: .Subject = Chr(34) & "Report for: " & @LogonDomain & " " & @COMPUTERNAME & Chr(34) .Subject = Chr(34) & "Report for: " & @LogonDomain & " " & @COMPUTERNAME & Chr(34)^ ERROR >Exit code: 1 Time: 2.942 Link to comment Share on other sites More sharing options...
BrewManNH Posted September 21, 2012 Share Posted September 21, 2012 What version of Exchange is running on the servers that work, and the ones that don't? Are they the same? 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