Computer Performance, Logon Scripts

Code Error 800A01B6 - Object doesn't  support this property or method

Troubleshooting Code 800A01B6 - Object doesn't support this property or method:

I find that error 800A01B6 occurs both with Logon Scripts and WMI scripts.  In fact, with Logon Scripts it's probably the fault of a spelling mistake in a method, whereas with WMI check the .Properties.

Introduction to error Code 800A01B6

This error code, 800A01B6 usually occurs when you execute a VBScript.  One of your commands is not valid.  My guess is that there is a typing error in one of the METHODS in your script.  Another common cause is to forget the 'Set' verb at the beginning of a statement.Error 800A01B6 Object doesn't does not support this property or method

Example 1 Logon Script

The script does not execute as you hoped, instead you get a WSH error message. The probably scenario is that you are creating a logon script using a WSH method that does not exist.

The Cause of Code 800A01B6

The secret with Code 800A01B6 is reading what the error box says after '... property or method:'.  In the example the error says EnumNetworkDrive and this gives a valuable clue as to what is wrong.

Your VBScript contains an illegal method, probably a typing mistake, an extra letter or space.  In the example, it's Line 17, EnumNetworkDrive that's causing the problem, it looks correct, however, research reveals that this method should be plural, EnumNetworkDriveS.

In passing, you may notice that Source: runtime error.  The significance is that error 800A01B6 is not a compilation error which would mean a syntax error.  Runtime errors are often typos which cause logical errors.

The Solutions Object doesn't support this property or method

Check the syntax of your script, particularly the method that you have used.  Look for clues, particularly in the Line: number.  In my example Line 17 is at fault.  However Char : 1 is a surprise as its actually the method about character 50. 

My advice is get Scriptomatic or Wbemtest and research the correct methods.  Alternatively, in the case of runtime errors you can use this work around.  Add this line: On Error Resume Next.

Example 1 of Script with error 800A01B6

Here is the problem: Set AllDrives = objNetwork.EnumNetworkDrive()
 

It should be a plural ....DriveS = objNetwork.EnumNetworkDriveS()

' VBScript to map two printers from two servers
' Guy Thomas February 2004.
' ******************************
Option Explicit


Dim objShell, objNetwork
Dim DriveLetter1, DriveLetter2, RemotePath1, RemotePath2
Dim AllDrives, AlreadyConnected, Network1, Network2, i

Set Network1 = CreateObject("WScript.Network")
DriveLetter1 = "S:" ' This letter must be in CAPITALS.
RemotePath1 = "\\alan\drivers"

Set objShell = CreateObject("WScript.Shell")
Set objNetwork = CreateObject("WScript.Network")
Set AllDrives = objNetwork.EnumNetworkDrive()


AlreadyConnected = False
For i = 0 To AllDrives.Count - 1 Step 2
If AllDrives.Item(i) = DriveLetter1 Then AlreadyConnected = True
Next

If AlreadyConnected = True then
objNetwork.RemoveNetworkDrive DriveLetter1
objShell.PopUp "Drive " & DriveLetter1 & " disconnected."

Else

objShell.PopUp "Drive " & DriveLetter1 & " no initial connection"

End if

objNetwork.MapNetworkDrive DriveLetter1, RemotePath1
objShell.PopUp "Drive " & DriveLetter1 & " connected OK."

WScript.Quit
' End of Script
 

Example 1b of Script with 800A01B6

Here is a simple fault, line 1 should be :

Set ObjNetwork = CreateObject("Wscript.Network")

Omitting the speech marks causes the error:

Set ObjNetwork = CreateObject(Wscript.Network)

Horribly wrong version

 

ObjNetwork = CreateObject(Wscript.Network)
Wscript.Echo objNetwork.UserName
 

 

Correct Version

 

Set ObjNetwork = CreateObject("Wscript.Network")
Wscript.Echo objNetwork.UserName
 

Example 2 Error 800A01B6  - WMIError 800A01B6  - WMI

 

This example shows a WMI script.  If you look carefully, then you can see a property that does not exist - STUPID.

With Error 800A01B6 in WMI script I find that the error is caused by copying and pasting scripts and not keeping your eye on the Win32_xyz object.  These objects have different properties, therefore, you cannot expect to change Win32_Bus to Win32_DiskDrive and expect the script to work.  No you need to check the properties.  In the case of this example, we get the line number and the name of the offending property.

 

 

' ShellTwo.vbs
' Template for a WMI script to interrogate Win32_Objects
' Author Guy Thomas http://computerperformance.co.uk/
' Version 2.2 - June 2005
' --------------------------------------------------------'
Option Explicit
Dim objWMIService, objItem, colItems, strComputer

' On Error Resume Next
strComputer = "."

' WMI Core commands to connect to object database
' ============================================
Set objWMIService = GetObject("winmgmts:\\" _
& strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery(_
"Select * from Win32_Bus")

' VBScript loop containing WMI Properties
' ============================================
For Each objItem in colItems
Wscript.Echo "Computer " & strComputer & vbCr & _
"Caption: " & objItem.Caption & VbCr & _
"STUPID " & objItem.STUPID & VbCr & _
"Description: " & objItem.Description & VbCr & _
"Name: " & objItem.Name & VbCr & _
" (More Properties in production script)"& VbCr & _
""
Next
WSCript.Quit

' End of Template WMI Sample VBScript

 

 


Computer Training Software - Recommended Training VideosGuy Thomas recommends Computer Training Software.  Their topics and material are ideal for getting you started with VBScript.  The videos are easy to follow and you can control the pace.  Try their free demo material and then see if you want to buy the full package. See more about VB Script Training CD.


Do you have a good example of this error?  If so, then email me I will publish it with a credit to you:

Do you need extra help?

For interpreting the WSH messages check Diagnose 800 errors.

For general advice try my 7 Troubleshooting techniques

 

 *


Google

WebComputerperformance.co.uk

GFi Events Manager

Guy Recommends: GFi EventsManager

Here is a solution to monitor, manage and archive thousands of events that are generated by devices across your entire network.  Get your free evaluation copy of GFI EventsManager.

 

Home Copyright © 1999-2008 Computer Performance LTD All rights reserved

Please report a broken link, or an error.