Skip navigation

Rem - 24 Jul 2000


Do you have a scripting-related question or problem? You can send your question or problem to [email protected].

I experience file-sharing-violation problems when I try to replace locked files (most frequently .dll and .exe files). I'm looking for a tool that can overwrite files even if they're in use. I'm using Robocopy and Xcopy extensively within scripts. However, I often have to capture the error level in the script and pass the error level to a loop function that makes continued attempts to copy the file to the destination directory. Robocopy has a retry switch, but what if the user keeps the file locked beyond Robocopy's retry limit? Can I use xcacls.exe to take ownership of the file and then overwrite it?

Xcacls.exe isn't going to help with updating locked files. I recommend trying the inuse.exe utility, which is part of the Microsoft Windows 2000 Professional Resource Kit and the Microsoft Windows 2000 Server Resource Kit. This command-line utility facilitates the replacement of locked files. The utility gets around the locking problem by performing the file replacement when you restart the computer. You can download inuse.exe from windows2000/library/resources/reskit/ tools/existing/inuse-o.asp. The download file includes documentation and an example batch file.

I recently created VBScript code that uses Active Directory Service Interfaces (ADSI) to enumerate all the groups in a domain and all the users in each group so that I can identify which groups contain disabled accounts. Everything works well except when the script enumerates and checks Local groups that contain Global groups. The Global groups don't have an Account Disabled flag, so the line at callout A in Listing 1 fails. How can I check what type of member I've retrieved from a group?

You can address this problem in a couple of ways. The first method is to use VBScript's Err object. The second and more elegant method is to examine the schema class name of the member. If the member is of class User, perform the Account Disabled check; otherwise, continue to the next group member. Listing 2 demonstrates the schema class name solution.

I'm trying to use ADSI to retrieve information from Novell NDS Provider and map that information to Windows NT. The goal is to have one console to manage both NT and Novell Directory Services (NDS). Documentation about getting information from Novell is scarce at best. Can you point me in the right direction?

You have a few options. If you haven't read the NDS-related information in the ADSI Programmer's Guide, I encourage you to start there. (You can access the guide at http:// loads/bin/nts/adsi25.chm.) You'll find information about using ADSI with NDS providers, including NDS example code. The examples demonstrate how to bind to NDS, retrieve and modify a user object's attribute, create a new user object, and search. You can access the documentation and example code from the Microsoft Developer Network (MSDN) Online Library ( library/default.asp). For the NDS example code, go to http://msdn Additional resources include

  • Microsoft's ADSI Newsgroup (
  • 15 Seconds' ADSI Mailing List (

I want to write messages to a window in Windows Script Host (WSH), but I don't want a pop-up box or dialog box that requires input—just a method of writing to the screen to show the progress of a WSH job. I know that you can use CScript and the Echo method to write to the screen. Can I use a similar method in Windows Script (WS) to write to a window?

You can use the WSH Popup method to display a graphical message box that doesn't require user input. The WSH Shell object exposes the Popup method. Popup is similar to VBScript's MsgBox function, with a key difference: Popup's second parameter is an optional parameter that represents the number of seconds to wait before the method silently closes the Popup window without user input. Popup.vbs in Listing 3 demonstrates how the Popup method works.

The script begins by setting VBScript's Option Explicit directive, declaring the script's variables and one constant, and initializing the variables. Next, the script creates a reference to a WSH Shell object and calls the Shell object's Popup method. Popup has one mandatory parameter—strText (the text you want to display in the Popup window)—and three optional parameters:

  • intSecondsToWait (the number of seconds the window appears before automatically closing)
  • strTitle (the text that you want to display in the Popup window's title bar)
  • intType (an integer that signifies the type of buttons and icons to display in the window)

The Popup method returns an integer that represents the button the user clicked; the method returns -1 if the user didn't click a button, signifying that the window closed because intSecondsToWait expired.

Popup executes synchronously, which means that your script blocks until the Popup method returns. As a result, Popup isn't well suited to being a progress indicator (e.g., a progress bar). If you want a progress bar, check out the Progress Bar available from the independent WSH FAQ Web site ( To access the folder containing the Progress Bar, use the navigation folders in the left pane of the Web site's home page to choose Sample Code, Download.

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.