Windows IT Pro is the authoritative and independent resource for windows nt, windows 2000, windows 2003, windows xp. Features a collection of resources and magazines for windows IT professionals.
  
  
  Advanced Search 


August 23, 1999

Rem


RSS
Subscribe to Windows IT Pro | See More Task Automation Articles Here | Reprints | Or get the Monthly Online Pass—only $5.95 a month!

Do you have a scripting-related question or problem? You can send your question or problem to win32sj@winntmag.com.

Q: How do you use VBScript to set and obtain Registry entries?

You can use VBScript with Windows Scripting Host (WSH). The WshShell object's RegRead, RegWrite, and RegDelete methods read, write, and delete Registry keys and values, respectively. You can find usage instructions and example code in the WSH technical paper "Windows Script Host Programmer's Reference" on the Microsoft Windows Script Technologies Web site. Go to http://msdn.microsoft.com/ scripting, and select Windows Script Host from the left navigation pane. In the right navigation pane, click Documentation. Select Technical Paper to view "Windows Script Host Programmer's Reference" online. You can also download the technical paper from this location.

Q: How can you automate the process of identifying the owners of files and directories?

You can write a script that uses the subinacl.exe utility, which displays and changes file and directory ownership. For more information about this console utility, run

C:\> subinacl /help

on a system that has Microsoft Windows NT Server 4.0 Resource Kit, Supplement Three installed.

Q: How can I merge two text files on two NT servers into one file?

You can use the Copy command in conjunction with the plus sign (+) to copy and append multiple files. The following code copies and appends a remote file named file2.txt to a local file named file1.txt in a new file named file3.txt:

C:\> copy file1.txt+\\dell610\c$file2.txt c:\file3.txt

You can learn more about the Copy command in the online Help or by typing

"copy /?"

at the command prompt.

Q: A friend sent me a Common Gateway Interface (CGI) program that runs with Perl. I installed Perl for Win32 (aka ActivePerl) on my NT server, but the CGI program doesn't work. How can I get ActivePerl and this program to work together?

If you're running Microsoft Internet Information Server (IIS) 4.0, ActivePerl configures your server to run Perl and CGI programs during ActivePerl Setup. Simply make sure you've selected the Associate '.pl' with Perl.exe for your Web server(s) option in the Select Perl Options dialog box during setup.

To configure IIS 4.0 manually, run the Internet Services Manager, right-click the Default Web Site, and choose Properties. In the Default Web Site Properties dialog box, select the Home Directory tab. At the bottom of the Home Directory page, select Configuration in the Application Settings section. In the Application Configuration dialog box, click Add. Enter the following values in the Add/Edit Application Extension Mapping dialog box:

  • For Executable, enter C:\Perl\bin\perl.exe %s %s.
  • For Extension, enter .pl.

If you're running an IIS version earlier than 4.0 or another Web server, check out ActiveState's perlwin32faq6 - web server info at http://www.activestate.com/ support/faqs/win32/ perlwin32 faq6.html for setup information.

Q: If you're using VBScript with WSH, which approach is best for sending email: using Collaboration Data Objects (CDO), Outlook objects, or Collaboration Data Objects for Windows NT Server (CDONTS)? I prefer using CDONTS because I assume that the other options require a Microsoft Exchange Server profile on the machine and the CDO or Outlook library. But can I use CDONTS if CDONTS and the IIS SMTP service that it uses are on another PC?

Your assumption is correct: You need the Exchange profile and the CDO or Outlook library to send email using CDO or Outlook objects. Unfortunately, using VBScript with WSH to create an object (in your case, CDONTS.NewMail) on a remote machine is impossible even though the VBScript documentation states otherwise. Supposedly, Microsoft plans to address this problem in a future release of VBScript.

For now, you need to install the CDONTS library on the local machine if you want to run VBScript/WSH code that uses CDONTS. An alternative might be to use a command-line utility, such as Sendmail. Many such utilities are available on the Internet, and you can use your favorite search engine to find one.

For more information about CDO and CDONTS, see the Microsoft Exchange Collaboration Web site at http://www.microsoft.com/ exchange/ collaboration.htm. You can download the white paper "Introduction to Collaboration Data Objects" from http:// www. microsoft.com/ exchange/55/ whpprs/ cdo.htm. For detailed CDO 1.2.1 and CDONTS programming information and code samples, visit the Microsoft Developer Network (MSDN) Online Library at http:// msdn.microsoft.com/ library/default.htm. In the left navigation menu, select Platform SDK, Messaging and Collaboration Services, CDO 1.2.1.

If you have a scripting-related question, send it to win32sj@winntmag.com. The question you submit will go to a team of scripting experts, who'll decide whether to use the question in the Rem column. Unfortunately, because of the volume of questions submitted, we can't answer and include all questions submitted to Rem.

End of Article



Reader Comments
Thanks for another great area to play in, I have been reading Bob's articles on WSH and enjoy it very much, this section is something I hope you will keep. As an administrator of an NT Network I am always looking at new ways to accomplish the tedious tasks and Scripting has been a big asset in my bag of tricks. As usual I have found alot of solutions reading this magazine. Thank you.

Bob Fox
Network Administrator
Controlled Access

Bob Fox August 24, 1999


You must log on before posting a comment.

If you don't have a username & password, please register now.




Top Viewed ArticlesView all articles
Command Prompt Tricks

One reader shares his tip for setting up the command prompt to reflect a remote path. ...

PsExec

This freeware utility lets you execute processes on a remote system and redirect output to the local system. ...

Autoruns

Tired of dealing with autostart programs? Use this free tool to find them and deal with them. ...


Task Automation Whitepapers Essential Guide to E-discovery and Recovery for Microsoft Exchange

Continuous Data Protection and Recovery for Microsoft Exchange

Protecting (You and) Your Data with Exchange Server 2007

Related Events Check out our list of Free Email Newsletters!

Task Automation eBooks Spam Fighting and Email Security for the 21st Century

A Guide to Windows Certification and Public Keys

Keeping Your Business Safe from Attack: Patch Management

Related Task Automation Resources Become a VIP member of the Windows IT Pro community!
Get it all with the VIP CD and VIP access. A $500+ value for only $279!

Subscribe to Windows IT Pro!
Solve your toughest technical problems with our experts and access 10,000 + articles online. 30% off

Monthly Online Pass - Only $5.95!
Get instant access to 10,000+ articles from Windows IT Pro Magazine!

TechNet Virtual Labs
Evaluate and test Microsoft's newest products.


Windows IT Pro Home Register FAQ for Windows WinInfo News
Europe Edition About Us Contact Us/Customer Service Media Kit Affiliates / Licensing  
SQL Server Magazine Office & SharePoint Pro Windows Dev Pro IT Job Hound ITTV
IT Library Technology Resource Directory Connected Home Windows Excavator Windows SuperSite 
 
 Windows IT Pro is a Division of Penton Media Inc.
 Copyright © 2008 Penton Media, Inc., All rights reserved. Terms and Use | Privacy Statement | Reprints and Licensing