Ошибка выполнения microsoft vbscript 800a0005

set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.CreateTextFile("C:output.txt", True)

Dim temp, key
temp = "mon pass"
key  = "qswx"
temp = Encrypt(temp,key)

Function encrypt(Str, key)
    ...
    ...
  Next
  encrypt = Newstr
End Function

objFile.WriteLine temp 'Error 800A0005 - Invalid procedure call or argument

The above code gives the following error in the last line:

erreur 800a0005 argument ou appel de procedure incorrect
Microsoft VBScript error ‘800a0005’
Invalid Procedure call or argument

When I use

WScript.Echo temp

it works perfectly.

Although I found similar problems none could provide a sufficient answer to my problem.

I came across an older VBScript that is used for communication and synchronization with Outlook. Somebody (not me) gets a strange error when running the script:

Script:
"Some path"
Line: 286
Character: 9
Error: Invalid process or invalid argument
Code: 800A0005
Source: Runtime Error in VBScript 

Now what I want to know is WHY that error occurs. Just a general interpretation of the error. But first here is the relevant code:

Set refnum = open_outputfile(outputfileverz & outputfilename_short)
  If (errcode = 0) Then
      If (check_textfile(refnum)) Then
          refnum.WriteLine (strOutput)
          errcode = close_outputfile(outputfileverz & outputfilename_short, outputfilename_short, refnum)
          If (errcode = 0) Then
              If (logging) Then 'mit Protokollierung
                  If (check_textfile(logrefnum)) Then
                      logrefnum.WriteLine ("--- " & Now() & " ---" & crlf & outputfilename_short & ":" & crlf & strOutput)
                      If (gBAbort) Then
                          logrefnum.WriteLine (errtext(33)) ' Abbruch durch den Benutzer
                      End if
                  End If
              End If
          Else
                  ok = false
          End If
      Else
          'errdetails = outputfileverz & outputfilename_short wurde schon in open_outputfile erstellt
          ok = False
      End If
  End If 

Line 286 is:

refnum.WriteLine (strOutput)

There are of course two other functions involved (open_outputfile/check_textfile) but they only return a document reference and check if it is a valid reference respectively.

Now I tried to reproduce the error and there is a problem: No matter what I do I don’t get this error. I’ve tried empty references, empty strings, wrote all kind of variable types but I always get other errors.

Can anybody tell me how or why this happens?

You may see a message like «Microsoft VBScript runtime error ‘800a0005′»  or «Invalid procedure Call or Argument»

/admin/savefile.asp, line 122

If you are receiving this message while uploading images, than your web server may not support some of the newer functions of VBscript.

This error message could be an indication that your server has an older or outdated version of the Microsoft Data Access Components (MDAC) and/or VBscript.  You should contact your web host or server administrator and request that they update the server with the most current MDAC and VBscript versions (they would need to contact Microsoft for this).  

Typically, this error only occurs on older web servers with an outdated version of VBScript installed, and on some Non-US Windows versions.  If you recently upgraded your server’s operating system or installed service packs / patches, this problem may be related. Visit Microsoft’s site for assistance and downloads.  

Please note, our free Technical Support does not cover this issue, as this error is directly related to your web server software.

IMAGE SIZE NOTE:
Be sure you are only uploading image files, the upload component was built for images (.jpg, .gif) with a size of less than 500k.  For other files you should use your own FTP software.

  • Remove From My Forums
  • General discussion

  • I’ve created a VBScript that aims to change folder share names on a server. This is currently running as a logon script for my test users.

    I’ve defined this function:

    Private Function intChangeShareName()
       Dim intPoz1, intPoz2, intIndex
       Dim strPom
    
       intChangeShareName = CONST_NO_CHANGE
    
       strActions = strActions & strOldNameShare & vbcrlf
      strPom = Trim(strOldNameShare)
      If Left(strPom, 2) <> "" then Exit Function
    
       intPoz1 = inStr(3, strPom, "")
       intPoz2 = inStr(3, strPom, ".")
       If intPoz2 > 0 Then
          strSrvName = Mid(strPom, 3, intPoz2 - 3)
          strDomName = Mid(strPom, intPoz2 + 1, intPoz1 - intPoz2 - 1)
       Else
         strSrvName = Mid(strPom, 3, intPoz1 - 3)
          strDomName = ""
       End If
    
       intIndex = 0
      Do while intIndex <= UBound(arrOldSrv)
         If UCase(strSrvName) = UCase(arrOldSrv(intIndex)) Then
            If strDomName = "" Then
               strNewNameSrv = arrNewSrv(intIndex)
               strNewNameDom = ""
            intChangeShareName = CONST_CHANGE
             End If
    
            If UCase(strDomName) = UCase(arrOldDom(intIndex)) Then
               strNewNameSrv = arrNewSrv(intIndex)
               strNewNameDom = "." & arrNewDom(intIndex)
            intChangeShareName = CONST_CHANGE
             End If
          End If
          intIndex = intIndex + 1
       Loop
    
       If intChangeShareName = CONST_CHANGE Then
          strNewNameShare = "" & strNewNameSrv & strNewNameDom & Mid(strPom, intPoz1)
          strActions = strActions & "*  " & strNewNameShare & vbcrlf
          blRequireLogoff = True
    '       Wscript.Echo "a " & strNewNameShare
       End If
    
    End Function

    However every time I log in I get the following error: VBScript runtime error — Invalid procedure call or argument: ‘Mid’ — Code 800A0005

    I don’t see anything wrong with my Mid function, can someone please help me?

    • Changed type

      Thursday, February 2, 2017 7:59 PM

    • Moved by
      Bill_Stewart
      Thursday, February 2, 2017 7:59 PM
      This is not «fix/debug/rewrite my script for me» forum

Hello,

I am trying to export windows 7 bitlocker key package to a file by use the following script (This script from Microsoft), some computer is OK, but on some computers, it was failed, the error message is:

Script:  D:GetBitLockerKeyPackage.vbs
Line:     236
Char:   3
Error:   Invalid procedure call or argument
Code:   800A0005
Source: Microsoft VBScript runtime error

Here is the script, could you please help me?

‘ The following sample script exports a new key package from an unlocked, encrypted volume.
‘ To run this script, start by saving the code into a VBS file (for example, GetBitLockerKeyPackage.vbs). ‘ Then, open an administrator command prompt and use “cscript” to run the saved file (for example, type «cscript GetBitLockerKeyPackage.vbs 
-?»).

‘ ———————————————————————————
‘ Usage
‘ ———————————————————————————

Sub ShowUsage
   Wscript.Echo «USAGE: GetBitLockerKeyPackage [VolumeLetter/DriveLetter:] [Path To Saved Key Package]»
   Wscript.Echo
   Wscript.Echo «Example: GetBitLockerKeyPackage C: E:bitlocker-backup-key-package»
   WScript.Quit
End Sub

‘ ———————————————————————————
‘ Parse Arguments
‘ ———————————————————————————

Set args = WScript.Arguments

Select Case args.Count
  Case 2
    If args(0) = «/?» Or args(0) = «-?» Then
      ShowUsage
    Else
      strDriveLetter = args(0)
      strFilePath = args(1)
    End If
  Case Else
    ShowUsage

End Select

‘ ———————————————————————————
‘ Other Inputs
‘ ———————————————————————————

‘ Target computer name
‘ Use «.» to connect to the local computer
strComputerName = «.»

‘ Default key protector ID to use. Specify «» to let the script choose.

strDefaultKeyProtectorID = «»

‘ strDefaultKeyProtectorID = «{001298E0-870E-4BA0-A2FF-FC74758D5720}»  ‘ sample

‘ ———————————————————————————
‘ Connect to the BitLocker WMI provider class
‘ ———————————————————————————

strConnectionStr = «winmgmts:» _
                 & «{impersonationLevel=impersonate,authenticationLevel=pktPrivacy}!» _
                 & strComputerName _
                 & «rootcimv2SecurityMicrosoftVolumeEncryption»

On Error Resume Next ‘handle permission errors

Set objWMIService = GetObject(strConnectionStr)

If Err.Number <> 0 Then
     WScript.Echo «Failed to connect to the BitLocker interface (Error 0x» & Hex(Err.Number) & «).»
     Wscript.Echo «Ensure that you are running with administrative privileges.»
     WScript.Quit -1
End If

On Error GoTo 0

strQuery = «Select * from Win32_EncryptableVolume where DriveLetter=’» & strDriveLetter & «‘»
Set colTargetVolumes = objWMIService.ExecQuery(strQuery)

If colTargetVolumes.Count = 0 Then
    WScript.Echo «FAILURE: Unable to find BitLocker-capable drive » &  strDriveLetter & » on computer » & strComputerName & «.»
    WScript.Quit -1
End If

‘ there should only be one volume found
For Each objFoundVolume in colTargetVolumes
    set objVolume = objFoundVolume
Next

‘ objVolume is now our found BitLocker-capable disk volume

‘ ———————————————————————————
‘ Perform BitLocker WMI provider functionality
‘ ———————————————————————————

‘ Collect all possible valid key protector ID’s that can be used to get the package
‘ ———————————————————————————-

nNumericalKeyProtectorType = 3 ‘ type associated with «Numerical Password» protector

nRC = objVolume.GetKeyProtectors(nNumericalKeyProtectorType, aNumericalKeyProtectorIDs)
If nRC <> 0 Then
WScript.Echo «FAILURE: GetKeyProtectors failed with return code 0x» & Hex(nRC)
WScript.Quit -1
End If

nExternalKeyProtectorType = 2 ‘ type associated with «External Key» protector

nRC = objVolume.GetKeyProtectors(nExternalKeyProtectorType, aExternalKeyProtectorIDs)
If nRC <> 0 Then
WScript.Echo «FAILURE: GetKeyProtectors failed with return code 0x» & Hex(nRC)
WScript.Quit -1
End If

‘ Get first key protector of the type «Numerical Password» or «External Key», if any
‘ ———————————————————————————-

if strDefaultKeyProtectorID = «» Then

‘ Save first numerical password, if exists
If UBound(aNumericalKeyProtectorIDs) <> -1 Then
strDefaultKeyProtectorID = aNumericalKeyProtectorIDs(0)
End If

‘ No numerical passwords exist, save the first external key
If strDefaultKeyProtectorID = «» and UBound(aExternalKeyProtectorIDs) <> -1 Then
strDefaultKeyProtectorID = aExternalKeyProtectorIDs(0)
End If

‘ Fail case: no recovery key protectors exist.
If strDefaultKeyProtectorID = «» Then
WScript.Echo «FAILURE: Cannot create backup key package because no recovery passwords or recovery keys exist. Check that BitLocker protection is on for this drive.»
WScript.Echo «For help adding recovery passwords or recovery keys, type «»manage-bde -protectors -add -?»».»
WScript.Quit -1
End If

End If

‘ Get some information about the chosen key protector ID
‘ ———————————————————————————-

‘ is the type valid?

nRC = objVolume.GetKeyProtectorType(strDefaultKeyProtectorID, nDefaultKeyProtectorType)

If Hex(nRC) = «80070057» Then
WScript.Echo «The key protector ID » & strDefaultKeyProtectorID & » is not valid.»
WScript.Echo «This ID value may have been provided by the script writer.»
ElseIf nRC <> 0 Then
WScript.Echo «FAILURE: GetKeyProtectorType failed with return code 0x» & Hex(nRC)
WScript.Quit -1
End If

‘ what’s a string that can be used to describe it?

strDefaultKeyProtectorType = «»

Select Case nDefaultKeyProtectorType

  Case nNumericalKeyProtectorType
      strDefaultKeyProtectorType = «recovery password»

  Case nExternalKeyProtectorType
      strDefaultKeyProtectorType = «recovery key»

  Case Else
      WScript.Echo «The key protector ID » & strDefaultKeyProtectorID & » does not refer to a valid recovery password or recovery key.»
      WScript.Echo «This ID value may have been provided by the script writer.»

End Select

‘ Save the backup key package using the chosen key protector ID
‘ ———————————————————————————-

nRC = objVolume.GetKeyPackage(strDefaultKeyProtectorID, oKeyPackage)
If nRC <> 0 Then
WScript.Echo «FAILURE: GetKeyPackage failed with return code 0x» & Hex(nRC)
WScript.Quit -1
End If

‘ Validate file path
Set fso = CreateObject(«Scripting.FileSystemObject»)
If (fso.FileExists(strFilePath)) Then
WScript.Echo «The file » & strFilePath & » already exists. Please use a different path.»
WScript.Quit -1
End If

Dim oKeyPackageByte, bKeyPackage
For Each oKeyPackageByte in oKeyPackage
  ‘WScript.echo «key package byte: » & oKeyPackageByte
  bKeyPackage = bKeyPackage & ChrB(oKeyPackageByte)
Next

‘ Save binary data to the file
SaveBinaryDataText strFilePath, bKeyPackage

‘ Display helpful information
‘ ———————————————————————————-

WScript.Echo «The backup key package has been saved to » & strFilePath & «.»

WScript.Echo «IMPORTANT: To use this key package, the » & strDefaultKeyProtectorType & » must also be saved.»

‘ Display the recovery password or a note about saving the recovery key file

If nDefaultKeyProtectorType = nNumericalKeyProtectorType Then

nRC = objVolume.GetKeyProtectorNumericalPassword(strDefaultKeyProtectorID, sNumericalPassword)
If nRC <> 0 Then
WScript.Echo «FAILURE: GetKeyProtectorNumericalPassword failed with return code 0x» & Hex(nRC)
WScript.Quit -1
End If
WScript.Echo «Save this recovery password: » & sNumericalPassword

ElseIf nDefaultKeyProtectorType = nExternalKeyProtectorType Then
WScript.Echo «The saved key file is named » & strDefaultKeyProtectorID & «.BEK»
WScript.Echo «For help re-saving this external key file, type «»manage-bde -protectors -get -?»»»
End If

‘—————————————————————————————-
‘ Utility functions to save binary data
‘—————————————————————————————-

Function SaveBinaryDataText(FileName, ByteArray)
  ‘Create FileSystemObject object
  Dim FS: Set FS = CreateObject(«Scripting.FileSystemObject»)

 
  ‘Create text stream object
  Dim TextStream
  Set TextStream = FS.CreateTextFile(FileName)

 
  ‘Convert binary data To text And write them To the file
  TextStream.Write BinaryToString(ByteArray)
End Function

Function BinaryToString(Binary)
  Dim I, S
  For I = 1 To LenB(Binary)
    S = S & Chr(AscB(MidB(Binary, I, 1)))
  Next
  BinaryToString = S
End Function

Regards,
Bruce Li_China

  • Remove From My Forums

locked

Microsoft VBScript runtime error ‘800a0005’ — Invalid procedure call or argument: ‘MidB’

  • Question

  • User770039553 posted

    Hi, we use a VBscript/Classic ASP function to upload attachments to a web application.  Since KB3104002 has been implemented this now fails with :

    Microsoft VBScript runtime error ‘800a0005’ 

    Invalid procedure call or argument: ‘MidB’

    If the Windows Update is removed then it functions as expected.  An example of the line which is failing is below :

      vDataBounds = MidB(biData, nPosBegin, nPosEnd-nPosBegin)

    It would look like the MidB function has somehow been removed.

    Can anyone advise on a solution to the issue. 

    Many thanks, Scott

Answers

  • User-823319154 posted

    Hi Scott,

    It is reported that KB3104002 update may
    be the reason that some classic ASP applications may not work correctly.

    You can try the
    Hotfix
    or you can uninstall the KB3104002 update.

    Please let me know if you need any other help.

    Best regards,

    Angie

    • Marked as answer by

      Tuesday, September 28, 2021 12:00 AM

    • Marked as answer by
      Anonymous
      Tuesday, September 28, 2021 12:00 AM

I am facing an issue in my application throwing an error

Microsoft VBScript runtime error ‘800a0005’
Invalid procedure call or argument: ‘mid’
strLine = Trim(Mid(strLine, 1, InStr(UCase(strLine), «SINGLE POINT DATA») — 1))

Main function is below

strLine = tstextstreamRead.ReadAll

If cint(intTestId) = 23 Then
    strLine2 = Trim(Mid(strLine, InStr(UCase(strLine), "SINGLE POINT DATA") + 1, Len(strLine)))
    strLine2 = Trim(Mid(strLine2, InStr(strLine2, "Model Cross-Arrhenius"), Len(strLine2)))
End If
response.write strLine

strLine = Trim(Mid(strLine, 1, InStr(UCase(strLine), "SINGLE POINT DATA") - 1))

When i verified through response.write strline

below i got the data

Sample ID Region :PACIFIC 
Request No :tesy 
Sample No :12 
Company :213 
Family :213 
Grade :213 
Standard :ZOLLER METHOD 
Color No :UNKNOWN 
Lot No :UNKNOWN 
Remark :213 
Date :7/22/2016 
Generic :123 
Operator :213 
Test Lab :WTC 
Test Name :Pressure-Volume-Temperature (PVT) 
Test Method :ZOLLER METHOD 
Dataset 0 
POINTS 26 30.2 1109.998 40.6 1126.961 50.8 1124.916 61.1 1121.716 71.3 1117.909 81.5 1113.674 91.4 1108.76 101.4 1103.019 111.8 1095.211 121.8 1087.404 131.8 1079.681 142.2 1072.674 152 1065.485 162.3 1057.771 172.1 1050.805 182.3 1043.491 193.4 1036.327 203 1029.239 214.1 1022.532 223.6 1015.535 234.6 1008.179 245.1 1000.297 255 993.677 265.6 986.178 275.4 979.918 285.8 973.305 
Dataset 50 
POINTS 26 30.2 1141.188 40.6 1145.201 50.8 1142.895 61.1 1140.183 71.3 1137.529 81.5 1134.817 91.4 1132.018 101.4 1129.33 111.8 1125.39 121.8 1120.212 131.8 1113.709 142.2 1107.681 152 1101.57 162.3 1095.298 172.1 1089.361 182.3 1083.419 193.4 1077.757 203 1072.34 214.1 1066.657 223.6 1061.414 234.6 1055.779 245.1 1049.333 255 1043.651 265.6 1038.333 275.4 1033.283 285.8 1028.57 
Dataset 100 
POINTS 26 30.2 1160.699 40.6 1159.695 50.8 1157.533 61.1 1155.299 71.3 1153.075 81.5 1151.028 91.4 1149.093 101.4 1147.7 111.8 1145.902 121.8 1142.99 131.8 1138.733 142.2 1133.957 152 1128.643 162.3 1123.009 172.1 1117.834 182.3 1112.526 193.4 1107.26 203 1102.65 214.1 1097.619 223.6 1093.004 234.6 1086.949 245.1 1082.376 255 1077.455 265.6 1072.812 275.4 1068.752 285.8 1064.607 
Dataset 150 
POINTS 26 30.2 1174.42 40.6 1172.732 50.8 1170.673 61.1 1168.593 71.3 1166.813 81.5 1165.074 91.4 1163.543 101.4 1162.673 111.8 1161.681 121.8 1160.11 131.8 1157.741 142.2 1154.905 152 1150.866 162.3 1146.22 172.1 1141.382 182.3 1136.381 193.4 1131.774 203 1127.484 214.1 1123.175 223.6 1118.773 234.6 1113.149 245.1 1108.975 255 1104.514 265.6 1100.457 275.4 1096.706 285.8 1093.423 
Dataset 200 
POINTS 26 30.2 1185.837 40.6 1183.95 50.8 1182.17 61.1 1180.377 71.3 1178.593 81.5 1177.103 91.4 1175.963 101.4 1175.373 111.8 1174.678 121.8 1173.552 131.8 1172.182 142.2 1170.538 152 1168.029 162.3 1164.802 172.1 1160.855 182.3 1156.361 193.4 1152.075 203 1147.987 214.1 1143.934 223.6 1139.92 234.6 1134.884 245.1 1130.755 255 1126.75 265.6 1123.348 275.4 1119.874 285.8 1116.635

Kindly let me know what is the exact problem.

  • Remove From My Forums
  • General discussion

  • I’ve created a VBScript that aims to change folder share names on a server. This is currently running as a logon script for my test users.

    I’ve defined this function:

    Private Function intChangeShareName()
       Dim intPoz1, intPoz2, intIndex
       Dim strPom
    
       intChangeShareName = CONST_NO_CHANGE
    
       strActions = strActions & strOldNameShare & vbcrlf
      strPom = Trim(strOldNameShare)
      If Left(strPom, 2) <> "" then Exit Function
    
       intPoz1 = inStr(3, strPom, "")
       intPoz2 = inStr(3, strPom, ".")
       If intPoz2 > 0 Then
          strSrvName = Mid(strPom, 3, intPoz2 - 3)
          strDomName = Mid(strPom, intPoz2 + 1, intPoz1 - intPoz2 - 1)
       Else
         strSrvName = Mid(strPom, 3, intPoz1 - 3)
          strDomName = ""
       End If
    
       intIndex = 0
      Do while intIndex <= UBound(arrOldSrv)
         If UCase(strSrvName) = UCase(arrOldSrv(intIndex)) Then
            If strDomName = "" Then
               strNewNameSrv = arrNewSrv(intIndex)
               strNewNameDom = ""
            intChangeShareName = CONST_CHANGE
             End If
    
            If UCase(strDomName) = UCase(arrOldDom(intIndex)) Then
               strNewNameSrv = arrNewSrv(intIndex)
               strNewNameDom = "." & arrNewDom(intIndex)
            intChangeShareName = CONST_CHANGE
             End If
          End If
          intIndex = intIndex + 1
       Loop
    
       If intChangeShareName = CONST_CHANGE Then
          strNewNameShare = "" & strNewNameSrv & strNewNameDom & Mid(strPom, intPoz1)
          strActions = strActions & "*  " & strNewNameShare & vbcrlf
          blRequireLogoff = True
    '       Wscript.Echo "a " & strNewNameShare
       End If
    
    End Function

    However every time I log in I get the following error: VBScript runtime error — Invalid procedure call or argument: ‘Mid’ — Code 800A0005

    I don’t see anything wrong with my Mid function, can someone please help me?

    • Changed type

      Thursday, February 2, 2017 7:59 PM

    • Moved by
      Bill_Stewart
      Thursday, February 2, 2017 7:59 PM
      This is not «fix/debug/rewrite my script for me» forum
  • Remove From My Forums
  • General discussion

  • I’ve created a VBScript that aims to change folder share names on a server. This is currently running as a logon script for my test users.

    I’ve defined this function:

    Private Function intChangeShareName()
       Dim intPoz1, intPoz2, intIndex
       Dim strPom
    
       intChangeShareName = CONST_NO_CHANGE
    
       strActions = strActions & strOldNameShare & vbcrlf
      strPom = Trim(strOldNameShare)
      If Left(strPom, 2) <> "" then Exit Function
    
       intPoz1 = inStr(3, strPom, "")
       intPoz2 = inStr(3, strPom, ".")
       If intPoz2 > 0 Then
          strSrvName = Mid(strPom, 3, intPoz2 - 3)
          strDomName = Mid(strPom, intPoz2 + 1, intPoz1 - intPoz2 - 1)
       Else
         strSrvName = Mid(strPom, 3, intPoz1 - 3)
          strDomName = ""
       End If
    
       intIndex = 0
      Do while intIndex <= UBound(arrOldSrv)
         If UCase(strSrvName) = UCase(arrOldSrv(intIndex)) Then
            If strDomName = "" Then
               strNewNameSrv = arrNewSrv(intIndex)
               strNewNameDom = ""
            intChangeShareName = CONST_CHANGE
             End If
    
            If UCase(strDomName) = UCase(arrOldDom(intIndex)) Then
               strNewNameSrv = arrNewSrv(intIndex)
               strNewNameDom = "." & arrNewDom(intIndex)
            intChangeShareName = CONST_CHANGE
             End If
          End If
          intIndex = intIndex + 1
       Loop
    
       If intChangeShareName = CONST_CHANGE Then
          strNewNameShare = "" & strNewNameSrv & strNewNameDom & Mid(strPom, intPoz1)
          strActions = strActions & "*  " & strNewNameShare & vbcrlf
          blRequireLogoff = True
    '       Wscript.Echo "a " & strNewNameShare
       End If
    
    End Function

    However every time I log in I get the following error: VBScript runtime error — Invalid procedure call or argument: ‘Mid’ — Code 800A0005

    I don’t see anything wrong with my Mid function, can someone please help me?

    • Changed type

      Thursday, February 2, 2017 7:59 PM

    • Moved by
      Bill_Stewart
      Thursday, February 2, 2017 7:59 PM
      This is not «fix/debug/rewrite my script for me» forum

Please Sign up or sign in
to vote.

1.00/5 (1 vote)

VB

set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objFile = objFSO.CreateTextFile("C:output.txt", True)

    Dim temp, key
    temp = "mon pass"
    key = "qswx"
    temp = Encrypt(temp,key)

    Function encrypt(Str, key)
     ..........

     ......

     Next
     encrypt = Newstr
    End Function

   objFile.WriteLine temp 'Error 800A0005 - Invalid procedure call or argument

When i us

VB

WScript.Echo temp

work perfectly

what to do to save the result?

Posted 6-Jun-15 3:51am

malak ivona

Add a Solution


1 solution

Please Sign up or sign in
to vote.

Solution 1

See http://stackoverflow.com/questions/17094281/getting-invalid-procedure-call-or-argument-in-vbscript[^]

This is because you have encrypted the value into something that .WriteLine can’t write to the file.

Permalink

Share this answer

Comments

malak ivona
6-Jun-15 22:19pm

thank you

ZurdoDev
6-Jun-15 22:20pm

You’re welcome.

Add a Solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Hello,

I am trying to export windows 7 bitlocker key package to a file by use the following script (This script from Microsoft), some computer is OK, but on some computers, it was failed, the error message is:

Script:  D:GetBitLockerKeyPackage.vbs
Line:     236
Char:   3
Error:   Invalid procedure call or argument
Code:   800A0005
Source: Microsoft VBScript runtime error

Here is the script, could you please help me?

‘ The following sample script exports a new key package from an unlocked, encrypted volume.
‘ To run this script, start by saving the code into a VBS file (for example, GetBitLockerKeyPackage.vbs). ‘ Then, open an administrator command prompt and use “cscript” to run the saved file (for example, type «cscript GetBitLockerKeyPackage.vbs 
-?»).

‘ ———————————————————————————
‘ Usage
‘ ———————————————————————————

Sub ShowUsage
   Wscript.Echo «USAGE: GetBitLockerKeyPackage [VolumeLetter/DriveLetter:] [Path To Saved Key Package]»
   Wscript.Echo
   Wscript.Echo «Example: GetBitLockerKeyPackage C: E:bitlocker-backup-key-package»
   WScript.Quit
End Sub

‘ ———————————————————————————
‘ Parse Arguments
‘ ———————————————————————————

Set args = WScript.Arguments

Select Case args.Count
  Case 2
    If args(0) = «/?» Or args(0) = «-?» Then
      ShowUsage
    Else
      strDriveLetter = args(0)
      strFilePath = args(1)
    End If
  Case Else
    ShowUsage

End Select

‘ ———————————————————————————
‘ Other Inputs
‘ ———————————————————————————

‘ Target computer name
‘ Use «.» to connect to the local computer
strComputerName = «.»

‘ Default key protector ID to use. Specify «» to let the script choose.

strDefaultKeyProtectorID = «»

‘ strDefaultKeyProtectorID = «{001298E0-870E-4BA0-A2FF-FC74758D5720}»  ‘ sample

‘ ———————————————————————————
‘ Connect to the BitLocker WMI provider class
‘ ———————————————————————————

strConnectionStr = «winmgmts:» _
                 & «{impersonationLevel=impersonate,authenticationLevel=pktPrivacy}!\» _
                 & strComputerName _
                 & «rootcimv2SecurityMicrosoftVolumeEncryption»

                

                

On Error Resume Next ‘handle permission errors

Set objWMIService = GetObject(strConnectionStr)

If Err.Number <> 0 Then
     WScript.Echo «Failed to connect to the BitLocker interface (Error 0x» & Hex(Err.Number) & «).»
     Wscript.Echo «Ensure that you are running with administrative privileges.»
     WScript.Quit -1
End If

On Error GoTo 0

strQuery = «Select * from Win32_EncryptableVolume where DriveLetter='» & strDriveLetter & «‘»
Set colTargetVolumes = objWMIService.ExecQuery(strQuery)

If colTargetVolumes.Count = 0 Then
    WScript.Echo «FAILURE: Unable to find BitLocker-capable drive » &  strDriveLetter & » on computer » & strComputerName & «.»
    WScript.Quit -1
End If

‘ there should only be one volume found
For Each objFoundVolume in colTargetVolumes
    set objVolume = objFoundVolume
Next

‘ objVolume is now our found BitLocker-capable disk volume

‘ ———————————————————————————
‘ Perform BitLocker WMI provider functionality
‘ ———————————————————————————

‘ Collect all possible valid key protector ID’s that can be used to get the package
‘ ———————————————————————————-

nNumericalKeyProtectorType = 3 ‘ type associated with «Numerical Password» protector

nRC = objVolume.GetKeyProtectors(nNumericalKeyProtectorType, aNumericalKeyProtectorIDs)
If nRC <> 0 Then
WScript.Echo «FAILURE: GetKeyProtectors failed with return code 0x» & Hex(nRC)
WScript.Quit -1
End If

nExternalKeyProtectorType = 2 ‘ type associated with «External Key» protector

nRC = objVolume.GetKeyProtectors(nExternalKeyProtectorType, aExternalKeyProtectorIDs)
If nRC <> 0 Then
WScript.Echo «FAILURE: GetKeyProtectors failed with return code 0x» & Hex(nRC)
WScript.Quit -1
End If

‘ Get first key protector of the type «Numerical Password» or «External Key», if any
‘ ———————————————————————————-

if strDefaultKeyProtectorID = «» Then

‘ Save first numerical password, if exists
If UBound(aNumericalKeyProtectorIDs) <> -1 Then
strDefaultKeyProtectorID = aNumericalKeyProtectorIDs(0)
End If

‘ No numerical passwords exist, save the first external key
If strDefaultKeyProtectorID = «» and UBound(aExternalKeyProtectorIDs) <> -1 Then
strDefaultKeyProtectorID = aExternalKeyProtectorIDs(0)
End If

‘ Fail case: no recovery key protectors exist.
If strDefaultKeyProtectorID = «» Then
WScript.Echo «FAILURE: Cannot create backup key package because no recovery passwords or recovery keys exist. Check that BitLocker protection is on for this drive.»
WScript.Echo «For help adding recovery passwords or recovery keys, type «»manage-bde -protectors -add -?»».»
WScript.Quit -1
End If

End If

‘ Get some information about the chosen key protector ID
‘ ———————————————————————————-

‘ is the type valid?

nRC = objVolume.GetKeyProtectorType(strDefaultKeyProtectorID, nDefaultKeyProtectorType)

If Hex(nRC) = «80070057» Then
WScript.Echo «The key protector ID » & strDefaultKeyProtectorID & » is not valid.»
WScript.Echo «This ID value may have been provided by the script writer.»
ElseIf nRC <> 0 Then
WScript.Echo «FAILURE: GetKeyProtectorType failed with return code 0x» & Hex(nRC)
WScript.Quit -1
End If

‘ what’s a string that can be used to describe it?

strDefaultKeyProtectorType = «»

Select Case nDefaultKeyProtectorType

  Case nNumericalKeyProtectorType
      strDefaultKeyProtectorType = «recovery password»

  Case nExternalKeyProtectorType
      strDefaultKeyProtectorType = «recovery key»

  Case Else
      WScript.Echo «The key protector ID » & strDefaultKeyProtectorID & » does not refer to a valid recovery password or recovery key.»
      WScript.Echo «This ID value may have been provided by the script writer.»

End Select

‘ Save the backup key package using the chosen key protector ID
‘ ———————————————————————————-

nRC = objVolume.GetKeyPackage(strDefaultKeyProtectorID, oKeyPackage)
If nRC <> 0 Then
WScript.Echo «FAILURE: GetKeyPackage failed with return code 0x» & Hex(nRC)
WScript.Quit -1
End If

‘ Validate file path
Set fso = CreateObject(«Scripting.FileSystemObject»)
If (fso.FileExists(strFilePath)) Then
WScript.Echo «The file » & strFilePath & » already exists. Please use a different path.»
WScript.Quit -1
End If

Dim oKeyPackageByte, bKeyPackage
For Each oKeyPackageByte in oKeyPackage
  ‘WScript.echo «key package byte: » & oKeyPackageByte
  bKeyPackage = bKeyPackage & ChrB(oKeyPackageByte)
Next

‘ Save binary data to the file
SaveBinaryDataText strFilePath, bKeyPackage

‘ Display helpful information
‘ ———————————————————————————-

WScript.Echo «The backup key package has been saved to » & strFilePath & «.»

WScript.Echo «IMPORTANT: To use this key package, the » & strDefaultKeyProtectorType & » must also be saved.»

‘ Display the recovery password or a note about saving the recovery key file

If nDefaultKeyProtectorType = nNumericalKeyProtectorType Then

nRC = objVolume.GetKeyProtectorNumericalPassword(strDefaultKeyProtectorID, sNumericalPassword)
If nRC <> 0 Then
WScript.Echo «FAILURE: GetKeyProtectorNumericalPassword failed with return code 0x» & Hex(nRC)
WScript.Quit -1
End If
WScript.Echo «Save this recovery password: » & sNumericalPassword

ElseIf nDefaultKeyProtectorType = nExternalKeyProtectorType Then
WScript.Echo «The saved key file is named » & strDefaultKeyProtectorID & «.BEK»
WScript.Echo «For help re-saving this external key file, type «»manage-bde -protectors -get -?»»»
End If

‘—————————————————————————————-
‘ Utility functions to save binary data
‘—————————————————————————————-

Function SaveBinaryDataText(FileName, ByteArray)
  ‘Create FileSystemObject object
  Dim FS: Set FS = CreateObject(«Scripting.FileSystemObject»)

 
  ‘Create text stream object
  Dim TextStream
  Set TextStream = FS.CreateTextFile(FileName)

 
  ‘Convert binary data To text And write them To the file
  TextStream.Write BinaryToString(ByteArray)
End Function

Function BinaryToString(Binary)
  Dim I, S
  For I = 1 To LenB(Binary)
    S = S & Chr(AscB(MidB(Binary, I, 1)))
  Next
  BinaryToString = S
End Function

Regards,
Bruce Li_China

  • Remove From My Forums

 locked

Microsoft VBScript runtime error ‘800a0005’ — Invalid procedure call or argument: ‘MidB’

  • Question

  • User770039553 posted

    Hi, we use a VBscript/Classic ASP function to upload attachments to a web application.  Since KB3104002 has been implemented this now fails with :

    Microsoft VBScript runtime error ‘800a0005’ 

    Invalid procedure call or argument: ‘MidB’

    If the Windows Update is removed then it functions as expected.  An example of the line which is failing is below :

      vDataBounds = MidB(biData, nPosBegin, nPosEnd-nPosBegin)

    It would look like the MidB function has somehow been removed.

    Can anyone advise on a solution to the issue. 

    Many thanks, Scott

Answers

  • User-823319154 posted

    Hi Scott,

    It is reported that KB3104002 update may
    be the reason that some classic ASP applications may not work correctly.

    You can try the
    Hotfix
    or you can uninstall the KB3104002 update.

    Please let me know if you need any other help.

    Best regards,

    Angie

    • Marked as answer by

      Tuesday, September 28, 2021 12:00 AM

    • Marked as answer by
      Anonymous
      Tuesday, September 28, 2021 12:00 AM

  • Ошибка выполнения microsoft jscript невозможно создание объекта сервером программирования объектов
  • Ошибка выполнения запроса к серверу слк проверьте настройки приложения сервера слк
  • Ошибка выполнения microsoft jscript код 800а1391
  • Ошибка выполнения запроса к серверу автодилер
  • Ошибка выполнения microsoft jscript код 800a0046