Code 8007052E Logon Failure: unknown user name or bad password

Troubleshooting Code Error 8007052E Logon Failure: unknown user name or bad password

Introduction to Error Code 8007052E  

This error, code 8007052E usually occurs when you try to map a network drive with a VBScript.  My suggestion is that there is a typo in the username or the password.  Error messages beginning 8007xxxx mean there is a problem with Windows rather than VBScript itself.

The Symptoms You Get 8007052E

When you execute the script you get a message box.  The VBScript does execute as you hoped.  One possibility is that the password needed by MapNetworkDrive  has been misspelt or omitted.

(Please send in a screen shot of the Error message in have this problem.)

The Cause of Code 8007052E

Your VBScript contains an illegal username or password.  Check the spelling of your objects in the script.  The source WshNetwork.MapNetworkDrive, help to track down the faulty part of the script.

The Solution

Check the spelling of your username and password.  In the case of runtime errors you can use a work-around.  Add this line: On Error Resume Next.

Guy Recommends:  SolarWinds’ Free Bulk Import ToolFree Download Solarwinds Bulk Import Tool

Import users from a spreadsheet.  Just provide a list of the users with their fields in the top row, and save as .csv file.  Then launch this FREE utility and match your fields with AD’s attributes, click and import the users.

Optionally, you can provide the name of the OU where the new accounts will be born. Download your FREE bulk import tool.

If you need more comprehensive software, download a free trial of SAM (Server & Application Monitor)

Example VBScript showing error 8007052E

Error Password StLouis

Should have been StL0u1s

Set objNetwork = CreateObject("WScript.Network")

strDriveLetter = "P:"
strRemotePath = "\\calan\home"
strUser = "Administrator"
strPassword = "StLouis"
strProfile = "False" ‘ means do not store in profile leave as false.
objNetwork.MapNetworkDrive strDriveLetter, strRemotePath, strProfile, strUser, strPassword

PowerShell Error Code 8007052E

The situation: you are trying to assign a PowerShell logon script to a Group Policy, the drive does not map.

Solution: Wrap the powershell.ps1 file in a batch file.

::Batch File for PowerShell Script
Powershell -NoLogo -file \\Computer\Share\logon.ps1 -WindowStyle hidden -NoProfile -executionpolicy bypass

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