Windows script host ошибка как исправить код 800a0408

Troubleshooting error code 800A0408 - Invalid Character WSCript or VBScript

Code  Error 800A0408 – Invalid Character

Troubleshooting Code 800A0408 – Invalid Character

Introduction to Code 800A0408

This error code, 800A0408 occurs when you execute a VBScript.  A wild guess a problem with an apostrophe, possibly in a ‘REM statement.Code  Error 800A0408 - Invalid Character

The Symptoms You Get

The script does not execute as you had hoped. Instead you get a WSH message box like this picture:

The Cause of error 800A0408

Your VBScript contains an illegal character, often at the beginning of a line.  It can happen if you copy the script from word, then paste into notepad.  For example, to ‘Rem out a line we need the apostrophe, which is ASCII character 39; however if you paste from word you may get ASCII 96 (Grave accent).

Note the clue Source: Microsoft VBScript compilation error, this means a syntax error in your script.

The Solutions

Check the punctuation marks in your VBScript, particularly look out for apostrophes and commas that do not display correctly.  The reference to Line: 1 Char 1, means that the very first symbol that is probably wrong.

  ‡

Example 1 of error code 800A0408 – Invalid Character

Note: The error  Rem VBScript

It should be ‘ Rem VBScript

  Rem VBScript
Set WshShell = WScript.CreateObject(«WScript.Shell»)
Set WshNetwork = WScript.CreateObject(«WScript.Network»)
Set AllDrives = WshNetwork.EnumNetworkDrives()

DriveLetter = «N:» ‘must be capitalized
RemotePath = «\alanhome»

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

If AlreadyConnected = False then
WShNetwork.MapNetworkDrive DriveLetter, RemotePath
WshShell.PopUp «Drive » & DriveLetter & » connected successfully.»

Else
WShNetwork.RemoveNetworkDrive DriveLetter
WshShell.PopUp «Drive » & DriveLetter & » disconnected.»
End if

»

Example 2 Code 800A0408 – Invalid Character

I include this screen shot just to emphasise that Char: number need not be one.  Thus Char: 20, or what ever your char number is, becomes a big clue in tracing obscure characters that may have sneaked into your script.

Code 800A0408 - Invalid Character

See More Windows Update Error Codes 8004 Series

• Error 800A101A8 Object Required   •Error 800A0046   •Error 800A10AD   •Error 800A000D

• Error 80048820   •Error 800A0401   •Review of SolarWinds Permissions Monitor

• Error 80040E14   • Error 800A03EA   • Error 800A0408   • Error 800A03EE

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?

  • For interpreting the WSH messages check Diagnose 800 errors.
  • For general advice try my 7 Troubleshooting techniques.
  • See master list of 0800 errors.
  • Codes beginning 08004…
  • Codes beginning 08005…
  • Codes beginning 08007…
  • Codes beginning 0800A…

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:

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


About The Author

Guy Thomas

  • Remove From My Forums
  • Question

  • Hello, reviving an old one on this forum: http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/special-characters-in-vbscript-strings/ and
    also as posted on: http://itknowledgeexchange.techtarget.com/itanswers/escaping-special-characters-in-run-with-administrator-privileges-script/

    I used this script:

    Here is a VB Script Vall Script that will get around the Password Prompt when «RunAs» is called…

    ‘Start

    ‘————————————————————————————

    ‘ To Run other VB Scripts or even Batch Files with Admin Priviliges’

    ‘———————————————————————————-

    Dim WshShell, objFSO

    suser
    = «YourAdminAccount@YourDomain.com»

    sPass = «YourPassWord»

    ‘——————————————————————————————————————————————————————————————

    ‘Put your Domain Account and Password in between the qoutes, REMEMBER! the Password will be clear text. If this is a standalone just take off the @YourDomain.com

    ‘——————————————————————————————————————————————————————————————

    sCommand = «wscript \UNCServerNameShareFolderYourScript.vbs»

    ‘—————————————————————————————————————————————————————————————————————

    ‘This will be the path were the scripted you want called will be at. Please note you can substitute the ablove for a local directory (Example: C:FolderYourScript.vbs)

    ‘————————————————————————————————————————————————————————————————————-

    Set objComputer = CreateObject(«Shell.LocalMachine»)

    Set WshNetwork = CreateObject(«WScript.Network»)

    Set WshShell = CreatObject(«WScript.Shell»)

    Set WshEnv = wshShell.Environment(«Process»)

    WinPath = WshEnv(«SystemRoot»)&»System32runas.exe»

    rc = WshShell.Run («runas /noprofile /user:» & suser & » » $ Chr(34) & sCommand & Chr(34))

    WScript.Sleep 900

    WshShell. AppActivate(WinPath)

    WScript.quit

    ‘End

Answers


  • suser = «YourAdminAccount@YourDomain.com»
    sPass = «YourPassWord»

    rc = WshShell.Run («runas /noprofile /user:» & suser & » » $ Chr(34) & sCommand & Chr(34))
    WScript.Sleep 900
    WshShell. AppActivate(WinPath)

    This is definitely ill-advised. There is a reason the runas program does not accept a password on its command line. To quote

    Raymond Chen:

    The RunAs program demands that you type the password manually. Why doesn’t it accept a password on the command line?

    This was a conscious decision. If it were possible to pass the password on the command line, people would start embedding passwords into batch files and logon scripts, which is laughably insecure.

    In other words, the feature is missing to remove the temptation to use the feature insecurely.

    In other words, you should not do this.

    Bill

    • Proposed as answer by

      Wednesday, May 2, 2012 6:16 PM

    • Marked as answer by
      IamMred
      Sunday, May 6, 2012 11:59 PM

Troubleshooting Code 800A0408 – Invalid Character

Introduction to Code 800A0408

This error code, 800A0408 occurs when you execute a VBScript.  A wild guess a problem with an apostrophe, possibly in a ‘REM statement.Code Error 800A0408 - Invalid Character

The Symptoms You Get

The script does not execute as you had hoped. Instead you get a WSH message box like this picture:

The Cause of error 800A0408

Your VBScript contains an illegal character, often at the beginning of a line.  It can happen if you copy the script from word, then paste into notepad.  For example, to ‘Rem out a line we need the apostrophe, which is ASCII character 39; however if you paste from word you may get ASCII 96 (Grave accent).

Note the clue Source: Microsoft VBScript compilation error, this means a syntax error in your script.

The Solutions

Check the punctuation marks in your VBScript, particularly look out for apostrophes and commas that do not display correctly.  The reference to Line: 1 Char 1, means that the very first symbol that is probably wrong.

  ‡

Example 1 of error code 800A0408 – Invalid Character

Note: The error  Rem VBScript

It should be ‘ Rem VBScript

  Rem VBScript
Set WshShell = WScript.CreateObject(«WScript.Shell»)
Set WshNetwork = WScript.CreateObject(«WScript.Network»)
Set AllDrives = WshNetwork.EnumNetworkDrives()

DriveLetter = «N:» ‘must be capitalized
RemotePath = «alanhome»

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

If AlreadyConnected = False then
WShNetwork.MapNetworkDrive DriveLetter, RemotePath
WshShell.PopUp «Drive » & DriveLetter & » connected successfully.»

Else
WShNetwork.RemoveNetworkDrive DriveLetter
WshShell.PopUp «Drive » & DriveLetter & » disconnected.»
End if

»

Example 2 Code 800A0408 – Invalid Character

I include this screen shot just to emphasise that Char: number need not be one.  Thus Char: 20, or what ever your char number is, becomes a big clue in tracing obscure characters that may have sneaked into your script.

Code 800A0408 - Invalid Character

See More Windows Update Error Codes 8004 Series

• Error 800A101A8 Object Required   •Error 800A0046   •Error 800A10AD   •Error 800A000D

• Error 80048820   •Error 800A0401   •Review of SolarWinds Permissions Monitor

• Error 80040E14   • Error 800A03EA   • Error 800A0408   • Error 800A03EE

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?

  • For interpreting the WSH messages check Diagnose 800 errors.
  • For general advice try my 7 Troubleshooting techniques.
  • See master list of 0800 errors.
  • Codes beginning 08004…
  • Codes beginning 08005…
  • Codes beginning 08007…
  • Codes beginning 0800A…

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:

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


check
Best Answer

  • Author Mike Brown

    So I had to go through the whole file and replace invalid characters.  This is rather frustrating.  What I think happened is I edited in Notepad at one point rather than Notepad++.

    I’ll have to change the default editor for vbs files or I’m going to do that again I’m sure of it.


    Was this post helpful?
    thumb_up
    thumb_down

  • View Best Answer in replies below

    5 Replies

    • Author Adam

      In the command line or a batch file try using «type old.vbs > new.vbs» to convert the file(s) to ansi.

      http:/ Opens a new window/www.robvanderwoude.com/type.php#Unicode Opens a new window


      Was this post helpful?
      thumb_up
      thumb_down

    • You need to post a snippet of your code, maybe the line and character referenced in the error?
      We do not have enough information to help with just the error.

      EDIT:
      After searching the error, it does seen to be an encoding issue.
      I have never seen that with NotePad++.


      Was this post helpful?
      thumb_up
      thumb_down

    • Author Mike Brown

      AdamRPL wrote:

      In the command line or a batch file try using «type old.vbs > new.vbs» to convert the file(s) to ansi.

      http:/ Opens a new window/www.robvanderwoude.com/type.php#Unicode Opens a new window

      Tried that and when I run the new file I get the same message.  Notepad++ is showing that it is ANSI.

      attach_file
      Attachment

      2014-01-23_13_34_…ection.png
      41.1 KB


      Was this post helpful?
      thumb_up
      thumb_down

    • Author Mike Brown

      Dave Rossi wrote:

      You need to post a snippet of your code, maybe the line and character referenced in the error?
      We do not have enough information to help with just the error.

      EDIT:
      After searching the error, it does seen to be an encoding issue.
      I have never seen that with NotePad++.

      It’s always line 1 character 1.

      Here is the beginning of the code:

      ‘——————————————————————————–
      ‘declare variables
      ‘——————————————————————————–
      
      Const ForAppending = 8
      
      Const LogFile = “c:tempjavauninstall.txt”
      
      ‘——————————————————————————–
      ‘create log file
      ‘——————————————————————————–
      
      Set objFSO = CreateObject(“Scripting.FileSystemObject”)
      
      Set objLogFile = objFSO.CreateTextFile(LogFile)
      
      sLog = “Started Java Uninstall”
      
      Call WriteLog(sLog)
      

      This script worked just fine until I edited it recently.


      Was this post helpful?
      thumb_up
      thumb_down

    • Author Mike Brown

      So I had to go through the whole file and replace invalid characters.  This is rather frustrating.  What I think happened is I edited in Notepad at one point rather than Notepad++.

      I’ll have to change the default editor for vbs files or I’m going to do that again I’m sure of it.


      Was this post helpful?
      thumb_up
      thumb_down

    RRS feed

    • Remove From My Forums
    • Question

    • when i start my computer i get this error message Microsoft VBScript compilation error. Code 800A0408

    All replies

    • Can you be more specific? ‘When I start my computer’ — does this message appear when the pc boots up? At what point does it appear?

      If this is literally when the computer boots it’s not an EW issue.

      Ian
      MS MVP Expression

      http://www.ew-resource.co.uk
      http://www.fp-resource.co.uk


      Ian Haynes

    • when the computer boots and any time i click on task manager.

    • when the computer boots and anytime i click on the task manager.
      thank you.

    • Sounds to me like you might have a startup script that’s doing this. Simply starting Task Manager won’t invoke any VBScript. Will this error occur if you just log in and don’t do anything else? Does it give you a file name? That error code means that there was an invalid character in a VBScript (.vbs more than likely) file.

      Jim Cheshire
      Jimco Software and Books
      http://www.jimcosoftware.com
      http://www.jimcobooks.com

      Author of:
      Microsoft Expression Web 3 In Depth
      Special Edition Using Microsoft Expression Web 2
      The Microsoft Expression Web Developer’s Guide to ASP.NET 3.5
      Special Edition Using Microsoft Expression Web

      My Expression Web 3 blog on Network World:
      http://www.networkworld.com/community/blog/10560

    • This error occur anytime i log in and don’t do anything else. The file name is C:WINDOWSsystem32winjpg.jpg

    • Sounds like you might have a virus.

      http://www.sophos.com/security/analyses/viruses-and-spyware/w32autorunalb.html

      Jim Cheshire
      Jimco Software and Books
      http://www.jimcosoftware.com
      http://www.jimcobooks.com

      Author of:
      Microsoft Expression Web 3 In Depth
      Special Edition Using Microsoft Expression Web 2
      The Microsoft Expression Web Developer’s Guide to ASP.NET 3.5
      Special Edition Using Microsoft Expression Web

      My Expression Web 3 blog on Network World:
      http://www.networkworld.com/community/blog/10560

    • Since this is a Windows not an Expression Web problem I would suggest that you ask in a Windows group or if Jim is correct in one of the anti-virus forums. In any event this is not the place to resolve your Windows boot issue.


      MS MVP Expression Tutorials & Help http://by-expression.com and online instructor led
      Expression Classes

    Понравилась статья? Поделить с друзьями:
  • Windows script host ошибка как исправить код 800a03ea
  • Windows script host ошибка как исправить код 800a0046
  • Windows script host ошибка как исправить код 80070002
  • Windows script host ошибка как исправить 800a1391
  • Windows script host ошибка как исправить 800a0009