Code Error 800704B0 – The specified device name is invalid

valign=”top” style=”padding-right: 8px; padding-bottom: 7px”>

Troubleshooting Code 800704B0 – The specified device name is invalid

Introduction to Code 800704B0

This error code, 800704B0 usually occurs when you try to map a network drive with a VBScript.  WSH is probably using a method called MapNetworkDrive or AddPrinterConnection.   Here is a wild guess, you have omitted the : (colon) on the Drive letter e.g. it should be = "M:" but you entered = "M".

The Symptoms You Get Code 800704B0 Error The specified device name is invalid - WSH VBScript

The script does not execute as you hoped, instead you get a WSH error message.  The probable scenario is that you are trying to create a Windows logon script.

The Cause of Error 800704B0

The problem is that you made a mistake with the drive letter.  It is not plain "M", it should have a colon and so be "M:"  Note that Source: WSHNetwork.MapNetworkDrive gives a valuable clue.  WSH has indicated Line 10, which narrow down the search.  Char 1 is not very helpful in this case.  What happens if there is an error on the line, sometimes Char 1 gets blamed.

Solutions for The specified device name is invalid

Edit Line 10

WShNetwork.MapNetworkDrive "M", RemotePath

Change the "M" to "M:"

WShNetwork.MapNetworkDrive "M:", RemotePath

Check this section for examples of MapNetworkDrive

  ‡

Example 1 of Script 800704B0

 

Set WshShell = WScript.CreateObject("WScript.Shell")
Set WshNetwork = WScript.CreateObject("WScript.Network")
Set AllDrives = WshNetwork.EnumNetworkDrives()

DriveLetter = "M:"
RemotePath = "\\alan\home"
strRemoteName = "Guy"

WShNetwork.MapNetworkDrive "M", RemotePath

WshShell.PopUp "Drive " & DriveLetter & " connected successfully."

 

Example 2 of Script 800704B0

objNetwork.addPrinterConnection "HP 4L", "\\Lucy4\HP Laser 4L"

Too many arguments, and also wrong method.

What it should be is :

objNetwork.addWindowsPrinterConnection  "\\Lucy4\HP Laser 4L"
Also note there is only one argument, the name of the shared printer.

 

‘ HPPrinter.vbs
‘ Script to map an HP Printer from the Lucy4 server
‘ Version 1.1 August 2010
‘ Guy Thomas https://computerperformance.co.uk

Option Explicit
Dim objNetwork

Set ObjNetwork = CreateObject("Wscript.Network")
objNetwork.addPrinterConnection "HP 4L", "\\Lucy4\HP Laser 4L"
Wscript.echo " Share Mapped "
Wscript.Quit

‘ End of Guy’s script

 

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