Subscribe to Windows IT Pro

 

Get Newsletters

  • Get the Latest News
  • Product Updates
  • Helpful Tricks
  • Productivity Tips

Subscribe Now!

August 23, 1999 12:00 AM

Rem

Windows IT Pro
InstantDoc ID #7135
Rating: (0)

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.

Related Content:

ARTICLE TOOLS

Comments
  • Bob Fox
    13 years ago
    Aug 24, 1999

    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

You must log on before posting a comment.

Are you a new visitor? Register Here

advertisement

advertisement

White Papers

Get your Windows 7 deployment off to the right start by implementing PC lockdown. A locked-down environment is easier and cheaper to support since users are less likely to make unnecessary changes to the core system configuration - read more here!

Essential Guides

Is your iSCSI "lossy"? The reality is that most off-the-shelf Ethernet hardware deployed for iSCSI can lose packets, resulting in slow performance or application downtime. Learn how to assess your current iSCSI infrastructure and engineer an advanced iSCSI SAN infrastructure.

Web Seminars

What's the best way to keep your network safe from malware? In this web seminar, security expert Greg Shields suggests an alternative method to the traditional blacklisting approach that is common with anti-virus and anti-malware solutions.

eLearning Series

We bring the experts direct to you to share their real-world perspective and expertise. During each event, three sessions stream in real time, so you can learn, ask questions, and get solutions.
Upcoming event: Getting the Most with Exchange 2010 with Paul Robichaux

Subscribe to Windows IT Pro!

Windows is a trademark of the Microsoft group of companies. Windows IT Pro is used by Penton Media Inc. under license from owner.