Following is an edited and annotated version of the question-and-answer log compiled during the Scripting Week 3 webcast Looks Aren't Everything, but.... For more information about Scripting Week 3 – including the Q-and-A logs for the other webcasts – please visit the Scripting Week 3 home page.
![]()
About yesterday's session: I was working with an HTA and I ran into the problem of having to create a Wscript.Sleep object which is not available in HTAs. I found a workaround but my question is: where can we find a reference on the workarounds for this object (Wscript objects) in an HTA?
To be honest, I don't think this is fully-documented anywhere. We'll have to see if we can throw something together and get it posted in the HTA Developer's Center in the Script Center.
![]()
May be shown today but: how do you sort data, be it in text file, array, dictionary object, whatever works?
There are a few ways - you can just use a bubble or quick sort; I think we have examples on the Script Repository. For multi-dimensional data you can use an ADO disconnected recordset: Friday's example scripts have one.
Post-Webcast Annotation. You can learn more about sorting data by viewing the Things the Scripting Guys Never Told You webcast from Scripting Week 2. |
![]()
Can you check the link for Monday’s Q and A? I get a page not found error.
Here's the verified link: http://www.microsoft.com/technet/scriptcenter/webcasts/sweek3/day1qanda.mspx. Note that this was just published this morning, so it might not have replicated to all the TechNet servers yet.
![]()
Will you set up a link to all of the daily supplements? I see the one for Tuesday, but do not see a link for Monday's.
I'll have to double-check on that. But, yes, the plan is to have a link to all the supplemental stuff. We'll get this taken care of.
![]()
Do processes (such as objIE/objWord/ObjExcel) ever close if you don’t call the quit method?
They'll keep on going if something doesn't close them. Try running a script and interrupting it, then check out the processes in Task Manager.
Post-Webcast Annotation: We should note that it depends on whether we are dealing with an “in-process” process or an “out-of-process” process. An in-process process will close automatically: that’s because it runs in the same process as the script. (Why don’t you need to quit the FileSystemObject? It’s because the FileSystemObject runs in the same process as the script; consequently, it ends when the script – and the script process – ends.) Also, there are some applications – such as Microsoft Access – that will automatically quit when the script quits; in fact, you have to add in extra code to ensure that Access doesn’t quit. In other words, this depends heavily on the process. |
![]()
Can you provide a link or URL to your sort example?
The bubble sort is here: http://www.microsoft.com/technet/scriptcenter/scripts/misc/output/msouvb06.mspx.
![]()
As a good programming practice do you recommend creating and destroying objects in each sub/function or is that pretty much pointless in VBScript and objects are better to be declared once per script globally?
Typically I (Greg) don't use functions and subroutines: in a great number of cases they seem to make the script needlessly complex, and without adding any real value. So I'm a big proponent of doing things globally as opposed to doing them in a bunch of functions/subroutines.
![]()
What is Scriptomatic?
It's the tool that writes WMI scripts for you: http://www.microsoft.com/technet/scriptcenter/tools/scripto2.mspx.
![]()
We should mention that you can use vbTab to concatenate strings out to a text file. Then you can read them into Excel with great ease.
Good point.
![]()
There are several WMI objects and it is difficult to find properties of them. Where are the documents for all the WMI objects and their properties?
In the WMI SDK: http://msdn.microsoft.com/library/en-us/wmisdk/wmi/wmi_start_page.asp. Also, use Scriptomatic (free download from Script Center) or Wbemtest.exe, available on most Windows machines.
![]()
For the question about Wscript in HTA I have found that Wscript.Shell can be instantiated in HTAs as an example. So not all Wscript.xxx functions fail.
The only thing that fails is the Wscript object itself (and thus Wscript.Echo, Wscript.Sleep, etc.). The reason it fails is that you can't create the Wscript object: i.e., CreateObject("Wscript"). Instead, the Wscript object can only be used with WSH. But, yes, other WSH objects can be created and used within an HTA.
![]()
How can we know if a service is started or stopped?
Use the WMI class Win32_Service and check the State property of the service.
![]()
I love the webcasts and I understand the need to make the code clean and simple, but could you please show some production-level scripts with big time error handling?
Check out the Doctor Scripto's Script Shop column. The examples are not production-level, but they're more complex and usually deal with error-handling.
![]()
Subs and Functions = Code Reusability.
In theory. In practice it doesn't always work that way, primarily because there's no straightforward way to use Include files in VBScript. If you use .wsf files it's a different story, but very people have adopted that format. If you like subroutines and functions that's great. If you don't, well, we think that's also fine.
![]()
Is there a Scriptomatic clone for IIS? Preferably IIS5 (and soon IIS6).
Because IIS 6.0 has a WMI provider the Scriptomatic works just fine with IIS 6.0; you just have to choose the IIS namespace. IIS 5.0 has no WMI provider (it's ADSI only) so, for now at least, there's no way to use the Scriptomatic with IIS 5. And, to be honest, it's unlikely we'll do one. (Too many things to do and not enough time.)
![]()
If I write a script that searches an Excel spreadsheet using Excel's COM object will it run on a computer that is using the free Excel Viewer?
Haven't actually tried it, but I don't believe it will work.
![]()
What tools do the Microsoft Scripting Guys use to write scripts? Notepad? Visual Studio?
Believe it or not, mostly Notepad.
![]()
Do the PowerPoint presentations of these webcasts include audio?
In 24 hours you'll receive a link for a streaming presentation with audio and slides. The audio is not included with the actual PowerPoint slides.
![]()
Where can you download MaticoScript.vbs?
Nowhere at the moment. We're still working on that.
![]()
I created an HTA which calls an external command (Ping) to test connectivity, but the command window is visible. Is there a way to hide that?
If you use the WshShell Exec method you can use cmd /c to close the window when you're done. Don't think it hides it while running. Maybe try WshShell Run, which lets you control the window.
Post-Webcast Annotation: Yes, you can hide the window by using Run, but then you won’t have direct access to the Ping output. Instead, you’ll have to save the data to a file and then read in the file to determine whether or not the ping succeeded. |
![]()
Where can i find info on using .wsf files?
There's not a lot of great information available, but you can start with the WSH documentation on MSDN: http://msdn.microsoft.com/library/en-us/script56/html/wsoriWindowsScriptHost.asp.
![]()
When sending output directly to a database (Access or SQL) what is the best way to establish the ODBC connection?
Are you talking about using ADO?
Post-Webcast Annotation: Generally speaking, a DSN is better than a hard-coded file path. If the database gets moved, it’s easier to change the location in the DSN than to edit the script. |
![]()
Subs/functions = useable code = cut and paste from Windows Scripting Guide 2000! Big ups to book: most useful purchase in a long time
Thanks, glad you're enjoying the book.
Post-Webcast Annotation: If you aren’t familiar with the Scripting Guide, you can read it (for free!) online. Also, as a special Scripting Week 3 promotion Microsoft Press is selling the book for 40% off. |
![]()
What is MaticoScript.vbs?
It's a script that was sent to us during Scripting Week 2 as part of the "send-us-a-script" promotion. It's a nice way to search WMI properties and classes.
![]()
WMI code creator is really useful, too: http://www.microsoft.com/downloads/details.aspx?FamilyID=2cc30a64-ea15-4661-8da4-55bbc145c30e&displaylang=en.
Yes, definitely. Though, obviously, this tool is aimed more at developers.
![]()
If I make a WMI call to a server, and I connect successfully, on some servers the query hangs (either returning nothing forever, or returning valid data repeatedly forever). Is there a way to trap that event in a VBScript so that the VBScript can kill that WMI connection and continue on to the next server?
Maybe you could put a kind of timeout on the query with Wscript.Sleep and then break out if no valid data comes back. But I'm not sure what event you could trap if valid data keeps coming back.
![]()
Opinion: if I'm currently writing VBScripts and HTAs should I be getting into WSF? Am I missing something by not doing so? It supports multi-engine but so does HTA. Maybe for the XMLish-ness of it?
I'm (Greg) not a big fan of the .wsf format: it has some neat features, but much of it requires you to wrap your script up in a bunch of meaningless XML. (It's XML for the sake of using XML, not because it adds anything to the script.) In talking with people from the WSH team they admitted that the .wsf format was never really finished: they implemented some of the features, but not all of them. Hence the feeling that it's not quite what it should be. In other words, you're probably not missing much by not using .wsf files. One possible exception: if you write in both VBScript and JScript you can mix languages within the same file. Otherwise ....
![]()
Instead of using ".htm" extension, could we use ".hta"?
Yes, and you have to put some header information in the file that configures the HTA. Jean will talk about this in depth tomorrow.
Post-Webcast Annotation: Technically you don’t have to put any information in the HTA:Application tag. The HTA will still run without it. |
![]()
I can't believe I have to type in all this HTML: who is actually doing this?
You don't have to type it in: you can download the scripts from the link in the custom panel.
Post-Webcast Annotation: Or download them from the Script Center home page. |
![]()
Are the Scripting Guys gearing up for scripts with Monad/MSH? Will any of the VBScript knowledge transfer?
We'll be doing something with Monad soon, as soon as they can assure us that the language is at least reasonably set-in-stone. As for whether or not any of your VBScript knowledge will transfer, well, sort of. For example, Monad's For Each loops don't look much like VBScript's For Each loops. But as long as you understand what a For Each loop does it will make it easier to figure out how to work with Monad's version. So while the mechanics don't transfer well the conceptual understanding will help.
![]()
What is the difference between the wsf and vbs? I have recently seen scripts with this extension and I was unaware of any differences.
Windows Script Files wrap scripts in an XML format that lets you use different script modules in different languages. So you can create something like a function library and call from it. Check out Alain Lissoir's web site and books; he uses this a lot.
![]()
Is there a way to put quotes around a variable and write it to a file as example an XML file? I want to feed server names in surrounded by quotes
One way to do that is to add the ASCII code for double quotes -- Chr(34) -- to the string. Thus: objFile.WriteLine Chr(34) & strServerName & Chr(34). Something like that.
![]()
I have a script that say runs every 15 minutes and creates an HTML page for the web. Will there be problems accessing the page from the web while it is being updated?
Hmm, haven't tried it, but I think you should get the old page while it's being updated.
![]()
Have you guys ever done a webcast on using scripts to pull data into Excel? I do this all of the time and it seems the most robust. This is great, but not nearly as useful for filtering, formatting, and parsing.
We did a webcast for Scripting Week 2 on scripting Office applications and that included a section on using Excel. We agree that Excel is a pretty handy tool for a scripter to use, which is why we have the entire Scripting for Office section in the Script Center.
![]()
Where is Alain Lissoir's web site?
Here: http://www.lissware.net.
![]()
I found a page I need but it’s too complicated for me: http://www.microsoft.com/technet/prodtechnol/exchange/55/support/adsi.mspx. I need to identify what is in the user’s extensionAttribute6 but I can’t seem to get a working script or good samples.
Have you tried in the Exchange SDK: http://msdn.microsoft.com/library/en-us/dnanchor/html/exchangesvr.asp.
![]()
Off topic, will WMI make it to Windows Vista?
Yes, WMI will be around for a long time. Parts of the .NET Framework and many other technologies rely on it.
![]()
Off topic and all apologies. However, have any of you guys been able to inventory a machine and pull an accurate number of processors even with hyper threading? If not will the next WMI handle this better?
I know that fixing this problem (dealing with processors and correctly identifying processor type) was recommended for the next version of WMI. However, I don't know whether any action will be taken on it. I guess we'll have to see.
![]()
Is there a reference script in the repository for sending the gathered array information to a SQL database?
You might take a look here and see if any of these scripts help: http://www.microsoft.com/technet/scriptcenter/scripts/misc/database/default.mspx.
![]()
Yes, that’s true, but what I was looking for are some kind of templates or an HTML generator.
OK, I get what you're saying. I don't think we've done an HTML generator, but it's a good idea.
Post-Webcast Annotation: You might take a look at the HTA Helpomatic, which provides at least some basic HTA/HTML coding. |
![]()
Is there a way to call a .vbs file from within a VBScript script?
Sure. Just use WSH's run command: objShell.Run("c:\scripts\myscript.vbs"). This will run the script, although it won't interact with the script in any way.
![]()
I'm bummed: I'm still waiting for my T-shirt from Scripting Week 2. I jumped through all the hoops.
Send your name and address to scripter@microsoft.com and we'll see what we can do.
Post-Webcast Annotation: We should note that originally we were not in charge of sending out T-shirts; that was handled by someone else. However, we now have a small supply of shirts ourselves, so let us know if you did not get one and we can take care of it. Remember, though, you must meet the criteria (watched a webcast, did a virtual lab, sent a script) to get a shirt. |
![]()
Can you provide the actual link for the HTML and DHTML reference in MSDN?
It’s here: http://msdn.microsoft.com/workshop/author/dhtml/reference/dhtml_reference_entry.asp?frame=true.
![]()
Is there a reference published which will define which functions of code work as a domain user versus local administrator, and so forth, for rights?
Not that I know of. In general, you must be a local administrator in order to change data. A regular user can read data on his or her local machine but can't read data from a remote machine. And, of course, scripts follow the rest of your security setup: if users aren't allowed to install their own software then they can't use a script to install software.
![]()
If you ran the VBScript with objShell.Exec, would you be able to interact with it then?
Yes, you could get back the standard stream, parse it, and do whatever with it.
Post-Webcast Annotation: Having said that, there are some limitations. Say you start script B from script A. Script B grabs some data and stores it in a variable. Script A will not have any knowledge of that data or that variable. So the interaction is limited. |
![]()
Can you all include more Access 2003 Scripting in your Office Space? VBA is nice but I (for example) need to automatically insert data into an existing table. Thanks.
You got it.
![]()
Is there a way to parse CSV records, not simple Split(record, ","), but complex CSV records with embedded quotes and commas?
You could probably write a regular expression to distinguish commas within quoted filenames, but it might be more worth your effort to use the Excel scripting API and make the CSV into a spreadsheet.
Post-Webcast Annotation: Just a note, too, that you can split on strings larger than a single character. For example, this is valid code: strFile = Split(strFile,”bob,fred”). |
![]()
Yes, something that generates all the script code for generating an HTML table based on a WMI query, for instance.
Good suggestion, we'll look into it.
![]()
Will the bonus material and Q and A be permanently posted on the ScriptCenter?
Yes. We'll get everything organized after this week.
![]()
I tried to implement multithreading as suggested in yesterday's Q and A by calling several Cscript.exes. Sometime I get "The instruction at "someMemory" referenced memory at "someMemory". The memory could not be "written". Is there a limit to the number of Cscript.exes that can run with out memory locks?
Haven't run into a limit on Cscript.exes; you should be able to see how much memory each is using and how much memory you have. I'm not aware of other constraints. Did you look at the Doctor Scripto's Script Shop columns that do this?
![]()
ADO handles quotes and commas wonderfully! Even in .CSV files.
ADO is a good way to go, worth using with CSV and text for problems like this.
![]()
Is there a way to see the percentage of the CPU a process is using like you can in Task Manager?
I believe the LoadPercentage property in the Win32_Processor class gives you this info.
Post-Webcast Annotation: Actually, the answer we gave shows overall CPU usage. The Win32_Process class allows you to calculate total processor time for an individual process, but not percentage. |
![]()
Are there any CSS editing tools that Microsoft recommends?
No, not really.
![]()
When parsing CSV files the easiest way I have found is to us ADODB and use the {Microsoft Text Driver (*.txt; *.csv)}. Then you can just load it to a recordset.
You can find more information about using ADO to parse text files here: http://msdn.microsoft.com/library/en-us/dnclinic/html/scripting03092004.asp.
![]()
How can we change the application icon for a HTA?
Use the ICON argument in the HTA:APPLICATION tag: (http://msdn.microsoft.com/workshop/author/hta/reference/properties/icon.asp). We'll talk more about HTA:APPLICATION tomorrow.
![]()
I want to write some Web pages (ASP) that can call WMI services to tell me if a service is running or not. On the server side, can I have the ASP page to call some VBScripts (vbs) that call the WMI services instead? Thanks.
Not sure about the security constraints on ASP: are the WMI scripts running against remote machines?
![]()
If you have a text file with computer names in quotes how do you strip out quotes when reading into a script?
You could read the whole file in (or read it line by line) and use the Replace function to get rid of all instances of Chr(34) -- double quotes -- with nothing. Thus: strFile = Replace(strFile, Chr(34), "")
![]()
I'd like to be able to post (to an HTML page) the availability -- or lack thereof -- of machines in our labs. Is there a quick, easy way to tell if a user is logged on to a machine?
You might be able to use Win32_ServerSession, which has a UserName property.
Post-Webcast Annotation: On Windows XP and Windows Server 2003 you can look at the WMI class Win32_ComputerSystem and the UserName property. This property and class are also available in Windows 2000, but the property gets populated only if the user logged on to a computer is a local user. |
![]()
It was mentioned Monday that Dr. Scripto began life as clipart. Do I remember someone saying he then was subject of a comic, or is my memory failing?
He's featured in each issue of the TechNet Flash.
![]()
What is working set size?
"Amount of memory in bytes that a process needs to execute efficiently—for an operating system that uses page-based memory management." That’s from http://msdn.microsoft.com/library/en-us/wmisdk/wmi/win32_process.asp?frame=true.
![]()
Is there a way to enable/disable hardware using scripts (i.e., enable or disable a network connection)?
Most of the WMI hardware classes don't have methods or writable properties. With a network adapter using DHCP, you could call the ReleaseDHCPLease method to temporarily disable the connection, but it's not really the same.
![]()
With respect to my previous question, my ASP page is only querying the local services (using WMI services). Do I still have security issue here? If so, any workaround?
There are always security issues when using ASP pages. Check the posted Q and A log in a day or two; when we post this, we'll add links to articles that discusses how to do this. (I know those articles exist, I just need to track them down.)
Post-Webcast Annotation: Here’s one place to start: http://msdn.microsoft.com/library/en-us/wmisdk/wmi/configuring_iis_5_for_wmi_asp_scripting.asp. |
![]()
An option to that is to put another column in and use the Webdings3 font: put a thumbs up or thumbs down and don’t mess with the background font. Cleans it up even more.
Nice idea, thanks
![]()
Is there a way to search for a text (a link) in an HTML page and click on that link when found using VBScript?
You could search for a link and, when you found it, create an instance of Internet Explorer. You could then use the Navigate method to point your instance of Internet Explorer to that Web site.
![]()
Do these scripts also integrate fine with XML/Web services? It would be most cool to provide these as a web service method that a user could browse to, run and see information on their local machine without having to send them a .vbs file (which are blocked at the firewall).
That's an interesting idea. I think you'd have to translate the script to a .NET language like Visual Basic .NET or JScript .NET, but I'm not sure there's a way to call a script as a method.
![]()
I'd like to put these HTML formatting code snippets into functions in an "include" file that my main script calls. Is that possible?
There are kind of kludgy work-arounds that can do this, but they aren't recommended. About the only way to do this is to use the .wsf format as opposed to .vbs.
![]()
Can I use VBScript to bind an IP address to a NIC? Maybe some examples on ScriptCenter?
Yes, you can and yes, there are examples on the Script Center: http://www.microsoft.com/technet/scriptcenter/scripts/network/client/modify/nwmovb01.mspx, and for more background, Automating TCP/IP Networking on Clients (http://www.microsoft.com/technet/scriptcenter/topics/networking/default.mspx).
![]()
Re: memory locks. I modified yesterday’s bonus script that creates an objIE and shows a table of servers. I created a separate script (ping.vbs); the script quits with Quit(0) success or Quit(1) Failed. I then use an ADOR to store all of my servers. It works great and finishes in 20 seconds for about 50+ servers. I occasionally get "cscript.exe - Application Error : The instruction at "0x5cd8297f" referenced memory at "0x5cd8297f". The memory could not be "written"." The memory is always different and the main script completes. I basically combine several scripto/scripting guys scripts to do this. Any ideas on what would cause cscript.exe to get the memory errors? Could it be the .Status or .ExitCode Calls from oExec? I don’t want you guys to be debugging my scripts; I just don’t know what is going on with memory reference errors.
Off the top of my head, I don't know what could cause that. If you want to email us at scripter@microsoft.com we'll see if we can find any information on possible memory problems with WSH. When you do so, let us know the operating system and service pack versions. Thanks.
![]()
Let's see a demonstration of the <marquee> tag for those service names, just for old time's sake.
We actually used the marquee tag as part of our bonus content for Scripting Week 3: http://www.microsoft.com/technet/scriptcenter/webcasts/sweek3/clue-3-is-here.mspx.
![]()
Re: the include question, could you use the ExecuteGlobal function to import the .vbs of one file inline into another? Although why anyone would include different .vbs files rather than just have it all in one file is beyond me.
Yes, that will work. It's not recommended, primarily because it wasn't designed to be an Include function. But it'll work.
![]()
When someone else runs an HTA I wrote to gather server information, they get "An error has occurred in the script on this page". "Invalid Namespace". The user is a local administrator. It runs fine from my computer (gathering info from the same server). Any ideas?
Different operating systems? Is this a WMI namespace? Also, are they running this locally or off your computer? HTAs will not run remotely.
![]()
Lately I have been using ADSI scripting to pull my computer names where the name is equal to "Windows 2000 Server". I then do an inventory script of each computer. Every once in a while I will come across a machine that is not there. What is the best way to test if the machine is there? The timeout greatly increases the time the script runs.
Do you mean testing if the machine is online? What about pinging it first? We talked about pinging in a script in yesterday's webcast.
![]()
Double quotes seems to be more efficient than using Chr(34).
True. The one potential problem with double quotes is that you can get yourself into a situation where you're combining double and single quotes: "'" With that it's hard to tell where the double quotes end and the single quotes began. Chr(34) is better for readability. But either one works just fine.
![]()
I usually set a constant for double-quotes for readability.
Thanks.
![]()
What operating systems support the CDO.Message object?
Windows 2000 and above for sure. And maybe NT 4 and Windows 98; I'm not sure about that.
![]()
If when setting up the frames you want to start with a "blank" or "splash" type page in the 90% frame, do you just omit the filename for the htm file (or provide a "splash.htm" filename)?
Splash.htm would be a good way to go.
![]()
Do you have a link to the SMTP information he's talking about?
SDK for SMTP server: http://msdn.microsoft.com/library/en-us/dnanchor/html/smtpserver.asp.
![]()
Can you please tell me the best Microsoft book to buy for beginners? This is a very interesting lecture but I am starting from no knowledge on scripting. All the best.
You might start with the Windows 2000 Scripting Guide, which you can read, for free, online: http://www.microsoft.com/technet/scriptcenter/guide/default.mspx. Also, you can buy this book (and others) for 40% off as a special Scripting Week 3 promotion: http://www.quantumbooks.com/scripting.
![]()
CDO.Message requires that you have Outlook installed, does it not?
No, I don't believe it does. Check out the SDK at http://msdn.microsoft.com/library/en-us/exchanchor/htms/msexchsvr_cdo_top.asp.
![]()
I love the fact that so many people are giving their tips in comments to work around limitations and make things easier. Can I recommend that more people give their tips as comments?
Sure.
![]()
NT4 server has an older library called CDONTS. It's similar to the CDOSYS available on 2000 or later, but most code does require some changes to work on one or the other
Thanks.
![]()
So if you don't supply a name at all (for a blank page) will it error? Or for a blank page do you need a "blank.htm" file?
I've never tried this, but "about:blank" might do the trick.
Post-Webcast Annotation: This code does, indeed work: <frame name=info about:blank>. However, it also appears that you can simply define the frame without specifying any contents: <frame name=info >. |
![]()
FYI: McAfee version 8 blocks port 25 by default. Unless you permit it, sending via CDO will fail.
I believe you can specify a different port when using CDO.
![]()
Does CDO.Message assume that Outlook is configured on the system that the script is being run on?
No, basic components of CDO are part of Windows.
![]()
Does the e-mail sending script require SMTP port 25 to be enabled on the client it runs on?
I believe you can specify a different port when using CDO.
![]()
For a script to send mail without installing SMTP: http://www.microsoft.com/technet/scriptcenter/scripts/message/smtpmail/mssmvb02.mspx.
Thanks.
![]()
You can configure CDO to send email using a remote SMTP server/port (with various authentication options, etc). That's not being shown in these examples, to keep things simple I presume.
I believe that's why Dean chose this route, yes. You can find some introductory CDO stuff here: http://www.microsoft.com/technet/scriptcenter/guide/sas_ent_cueg.mspx.
![]()
Sorry, I missed how you configure CDO.Message in regards to the SMTP server name, port, etc.
See the script example at http://www.microsoft.com/technet/scriptcenter/scripts/message/smtpmail/mssmvb02.mspx.
![]()
Can CDO send meeting requests?
Not sure. You might take a look at the CDO documentation for more info: http://msdn.microsoft.com/library/en-us/cdosys/html/f928be29-59e2-4341-86c9-31842075775a.asp. Also http://www.slipstick.com has info about using CDO.
![]()
To change SMTP port: objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
Yep, that's the line.
![]()
Some of the comments seem very appropriate. Will they be included in the FAQ?
We will post the Q and A in the Script Center, probably within the next two days. And, sooner or later, all the Q and As from all 5 webcasts will be posted in the Script Center.
![]()
I tried the BasicEmail script and get a "SendUsing" configuration value is invalid.
Yes, you have to have an SMTP server configured. See an example script at http://www.microsoft.com/technet/scriptcenter/scripts/message/smtpmail/mssmvb02.mspx.
![]()
I've never had luck getting CDO.Message working. I'll have to try it again. I usually use BLAT to send my messages.
If BLAT works then we'd say keep using BLAT.
![]()
When I use the SMTP mail script from the ScriptCenter to send to my Exchange server, the recipient receives the message in their junk email folder. Is there a way I can make it so Exchange doesn't interpret these as junk?
Boy, sorry. That's a bit outside our area of expertise.
![]()
Blat works very well.
Thanks.
![]()
Processors: do a processor script
I think there are some of these in the Script Center Script Repository.
![]()
CEmail also works.
Thanks.
![]()
Blat is excellent, I use it to email reports in lots of my scripts. I’m going to try CDO and see how it goes.
Good luck.
![]()
Can you use the email script to send message using LotusNotes?
Sorry, we don't know too much about Lotus Notes. If it supports SMTP it's probably possible.
![]()
There are some third-party DLLs that you can use for email. Assumes you have an internal SMTP server.
Thanks.
![]()
Should I receive an email confirming that my survey was received?
You won't receive a confirmation email. If you hit that submit button then we received your survey. Thanks!
![]()
Are you guys still giving out those sweet Scripting Guy mugs?
Yes. Watch 3 of the 5 Scripting Week 3 webcasts and submit the evaluation form for each of those 3. That'll get you a mug. And you can watch either the live presentations or the archived version.
![]()
Can you call Outlook from a script to send email?
Yes, although it won't be totally seamless: due to security measures added to Outlook you'll have to click a dialog box authorizing the script to send the mail before it will actually do so.
![]()
Great; when can we inspect those mugs? The coffee is waiting. :)
We'll post a picture in the Script Center as soon as we have one.
![]()
Can CDO do blind copy or CC?
Not sure, to be honest. You might check the CDO documentation: http://msdn.microsoft.com/library/en-us/exchanchor/htms/msexchsvr_cdo_top.asp.
![]()
If I send a script to scripter@microsoft.com (zip/txt) will you guys even get it, regardless if I get a response or not
We read all the mail we receive, although we can only respond to some of it. (That depends on how much time we have on a given day.)
![]()
“A technique I have used is to write to a file but rather than HTML, I use SMTP formatted. I then just drop file in pickup directory of mail server. It gets picked up and sent.” Can someone send me information on this technique? This will resolve an issue I have.
This is something we've never tried but we'll see what we can do.
![]()
Yeah, CDO can blind (BCC) and carbon copy (CC).
Thanks.
![]()
I know that you can hide a typed-in password. Is there a native way of encrypting the password so that it can be stored?
Not that we know of.
![]()
I was out of town Monday. Is Monday's briefing in the archive?
Yes: http://www.microsoft.com/technet/scriptcenter/webcasts/sweek3/day1qanda.mspx.
![]()
But can you get scripts as attachments.
Note: it’s always best to send scripts as .txt files or wrapped up in a .zip file. Many mail servers automatically strip off .vbs attachments.
![]()
Jean: Tomorrow I would love to see a dynamically-built HTA of checkboxes/radio buttons based on input of server names (or some variable list obtained at the startup of the HTA).
We'll dynamically build lists for list boxes, which you should be able to apply to other controls. See you tomorrow!
![]()
I’d like to see a WinPE talk.
Hmmm .... We'll have to look into that.
![]()
What would be the best way to run the script that is going to page you? Obviously you want to gather some information and analyze it, but I guess you don't want to leave CMD window open.
If you run the script under Wscript there won't be a command window.
![]()
I know there are some updates coming in Vista for WMI. Any chance they are going to kick up the registry monitor piece?
I'm not sure, but I wouldn't count on it. However, there might be a new and better way to work with events and to do monitoring. We’ll have to wait and see what happens there.