VBscript not working on NT platform...A stumper!!

Posted on 2006-06-28
Medium Priority
Last Modified: 2010-04-07
Would anyone know why a VBscript that works on 2000 and 2003, wouldn't work on NT?
Question by:SpinBob
  • 4
  • 4
LVL 16

Expert Comment

ID: 17001333
Without seeing what is in your script...one guess is because you're using WMI

you can download wmi for NT here:

Other than that you'll have to post your script or at least the part it failed on.
what was the error message?

Author Comment

ID: 17001653
The script pulls the data from a csv test file and either Enables, Deletes or Disables the user account based on the input file. Here's the Function for Delete user. The error message is "File name or class name not found during Automation operation". Again, this works on all 2000 and 2003 platforms. It breaks on NT. The NT plaforms are at Sp6 with all of the updates. The MDAC, JET, WSH and WMI are all updated.

Function fncDeleteUser(strInHost, strInUser)
  On Error Resume Next
  Set objStore = GetObject("WinNT://" & strInHost)     <-- This is the line where I get the error message
  Call objStore.Delete("user", strInUser)
     If err.number <> 0 Then
        strCurrentDescription = "USER NOT FOUND"
     End If
  fncLogOut strInHost,strInUser,strCurrentDescription,"Delete"
End Function

Author Comment

ID: 17001672
That's text file, not test file.
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

LVL 16

Expert Comment

ID: 17003158
What happens if you put this line after the on error resume next:
msgbox strInHost

Where is this script running from...does the account it is running from have the necessary permissions?

does it fail if you hard coded everything?
Set objStore = GetObject("WinNT://NTComputer")

I don't know what the differences are with NT 4.0 and I can't test them but would changing that line to this be any different
GetObject("WinNT://" & strInHost & "")
( Hey...its worth a shot )
LVL 41

Expert Comment

ID: 17006208
I was thinking that the strInHost name is probably a FQN name like SomeServer.SomeDomain.Com rather than a NetBIOS name such as SOMESERVER

Author Comment

ID: 17007359
It's returning the machine name, GetObject("WinNt://NTcomputer), it's puking on something that's for sure.

I'm really confused by it all. I've covered the internet and all of the scripts keep using GetObject(), but it doesn't work. The NT Servers being tested are not PDCs or BDCs, these are Standalone, with no Active Directory. The test bed is a Workgroup not a domain.

LVL 16

Accepted Solution

mdiglio earned 2000 total points
ID: 17009176
Just for clarification, when I suggested hardcoding ("WinNT://NTComputer")
I meant to say ("WinNT://YOUR-NTComputer-NAME")

While looking for the possible causes I have also seen the GetObject written like this:
Set objStore = GetObject("WinNT://" & strInHost & ",computer")

This line came from here:

I think that link also suggests downloading
Active Directory Extension for Windows NT 4.0

I know you're in a workgroup and not a domain but give that a look.
I would be hesitant to load anything new on your NT server just yet

Author Comment

ID: 17011006
Well done mdiglio. It was the Dsclient I was missing. All is well. You earned the 500 points my friend. Thanks to everyone for your help.
LVL 16

Expert Comment

ID: 17011395
Glad you got it working!
Thanks for the points

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

622 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question