Code  80071392 – Object Already Exists

valign=”top” style=”padding-right:35″ colspan=”2″>

Troubleshooting Code 80071392- Object already exists

This error code, 80071392 occurs when the printer or network drive already exists.  A wild guess, you are running the script for the second time.  If so, you could consider error correcting code, see example 2 below.

Introduction to Error Code 80071392

This is an easy error code to troubleshoot.  Code 80071392 usually occurs when you execute a VBScript.  Most likely the object has already been created, perhaps you are running the script for a second time.Code 80071392  Object already exists

The Symptoms You Get 80071392

The script does not execute as you hoped, instead you get a WSH error message.  One possibility is that you are using a WSCRIPT and the object is already in Active Directory.

The Cause of Code 80071392

Active Directory already knows about the user, OU or computer that you are trying to create.  The problem is you are trying to create another object with the same name. Check the Line: number.  Char 1: often lies! it just means that the whole line will not execute.

The Solutions

1) Delete the object and start again. 

2) Add this line in the script: on error resume next.


Example 1 – Script with 80071392 error

Note: The error is reported as Line 7, however it is actually the previous line where the problem was created.  objUser.SetInfo just causes the error to emerge.

‘Script to Create a new Contact account in the BulkImport OU
‘Script created by Guy Thomas
‘Feel free to adapt names

Set objOU = GetObject("LDAP://OU=BulkImport, dc=cp, dc=com")
Set objUser = objOU.Create("contact", "cn=SalesMan")

Wscript.Echo "Success new Contact "


Example 2 – Adding Error Correcting Code to deal with Code Error 80071392

This script offers something a little different, not so much an error as example of error correcting code.

In this example I am creating a child OU. To handle the error I divided the OU path into strParent and strContainer.  Most of the error correcting takes place in the subroutine called GuyError().



‘ VBSCript to create a child OU (Organizational Unit)
‘ With Error Correcting code
‘ Author Guy Thomas
‘ Version 2.4 – September 2010
‘ ———————————————————-‘
Option Explicit
Dim objRoot, objDomain, objOU
Dim strContainer, strParent
err.number = vbEmpty

‘ Section to bind to YOUR Active Directory.
Set objRoot = GetObject("LDAP://rootDSE")
objDomain = objRoot.Get("defaultNamingContext")
Set objDomain = GetObject("LDAP://" & objDomain)

‘ Section to create the OU defined by strContainer
strParent ="OU=Accounts3"
strContainer ="OU=Child9," & strParent

On Error Resume next
Set objOU = objDomain.Create("organizationalUnit", strContainer )
objOU.Put "Description", "Guy’s OU"

‘ Error Correcting Code
If Err.Number <> vbEmpty Then
    Call GuyError
    WScript.Echo "New Child OU created = " & strContainer
End If

‘ Error Correcting code to create Parent OU
Sub GuyError()
If Err.number = "-2147019886" then
     Wscript.Echo "Child OU already created"
     Wscript.Echo "Error " & Err.number
     Set objOU = objDomain.Create("organizationalUnit", strParent )
     objOU.Put "Description", "Guy’s Bulk Users OU"
     Set objOU = objDomain.Create("organizationalUnit", strContainer )
     WScript.Echo strParent & " Child and Parent OU Created "
End If
End Sub


Note 1:  Firstly, I researched the err.number for situations where the OU already existed, it turn out that the number was -2147019886.   You may be more familiar with this error as WSH Error: 80071392.

Example 3 – 80071392  Kindly Supplied by David Rocke

I discovered recently that Group.IsMember() returns FALSE when Group is "Domain Users" even though the user within that domain IS a member. This caused Error "". I have included a chunk of code where I have highlighted this and shown the use of "On Error Resume Next".

It should be noted that "On Error Goto ErrHandler" did not work, the error thrown by ADS seemed to circumvent it!


Sub AddUserToGroup(objUser As IADsUser, objGroup As IADsGroup)
  With objGroup
   ‘Retrieve information.
    If .IsMember(objUser.ADsPath) Then
      ‘Already a member so don’t add.
      ‘ADS returns FALSE if the group in question is "Domain Users".
      ‘Use "On Error Resume Next" to avoid
      ‘&h80071392 "Automation Error – Object already exists"
      On Error Resume Next
         .Add objUser.ADsPath
      On Error GoTo 0
  End If
 End With ‘objGroup
 Set objGroup = Nothing
End Sub


Solarwinds Free WMI MonitorGuy Recommends: WMI Monitor and It’s Free!

Windows Management Instrumentation (WMI) is one of the hidden treasures of Microsoft operating systems.  Fortunately, SolarWinds have created the WMI Monitor so that you can examine these gems of performance information for free.  Take the guess work out of which WMI counters to use for applications like Microsoft Active Directory, SQL or Exchange Server.

Download your free copy of WMI Monitor

Do you need additional help?

Give something back?

Would you like to help others?  If you have a good example of this error, then please email me, I will publish it with a credit to you:


Download my Logon Script eBook for only $6.25

Logon ScriptThe extra features you get in your eBook include, more pages full of detailed examples.  Also, ten ‘how to…’ sections, with screen shots showing which menus to use.  Go for Guy’s eBook – and get a printable version with copy enabled and no expiry date.

  Jumbo Script 7 Package

If you like this page then please share it with your friends