473,503 Members | 1,633 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Windows Script Host Type mismatch 800A000D error

2 New Member
Hi all,

I have used the following code in the past under Windows Xp without issue to run a series of configuration files based on the IP range. However, I get the above error message on Line 79 Char 7 (the Split command) under Windows 7 64-bit. I'm stumped, any ideas?

Expand|Select|Wrap|Line Numbers
  1. Option Explicit
  2. Dim IP_Address : IP_Address = GetIP()
  3. IP_Address = ip2num(IP_Address)
  4.  
  5. If IP_Address = "0.0.0.0" OR IP_Address = "" Then
  6.   MsgBox "No IP Address found – Unable to configure."
  7. Else
  8.       Dim WshNetwork
  9.       Dim objShell
  10.       Set WshNetwork = CreateObject("WScript.Network")
  11.       Set objShell = CreateObject("Wscript.Shell")
  12.   If IP_Address >= ip2num("10.100.10.1") _
  13.     And IP_Address <= ip2num("10.100.10.79") Then
  14.     Set objShell = WScript.CreateObject("WScript.Shell")
  15.     objShell.Run("%comspec% /K C:\Scripts\Machine\d.bat"), 1, True
  16.   ElseIf IP_Address >= ip2num("10.100.10.80") _
  17.     And IP_Address <= ip2num("10.100.10.89") Then
  18.     Set objShell = WScript.CreateObject("WScript.Shell")
  19.     objShell.Run("%comspec% /K C:\Scripts\Machine\baseConfig.bat"), 1, True
  20.   ElseIf IP_Address >= ip2num("10.100.10.90") _
  21.     And IP_Address <= ip2num("10.100.10.254") Then
  22.     Set objShell = WScript.CreateObject("WScript.Shell")
  23.     objShell.Run("%comspec% /K C:\Scripts\Machine\d.bat"), 1, True
  24.   ElseIf IP_Address >= ip2num("10.100.20.1") _
  25.     And IP_Address <= ip2num("10.100.20.254") Then
  26.     Set objShell = WScript.CreateObject("WScript.Shell")
  27.     objShell.Run("%comspec% /K C:\Scripts\Machine\h.bat"), 1, True
  28.   ElseIf IP_Address >= ip2num("10.100.30.1") _
  29.     And IP_Address <= ip2num("10.100.30.254") Then
  30.     Set objShell = WScript.CreateObject("WScript.Shell")
  31.     objShell.Run("%comspec% /K C:\Scripts\Machine\sunset.bat"), 1, True
  32.   ElseIf IP_Address >= ip2num("10.100.40.1") _
  33.     And IP_Address <= ip2num("10.100.40.254") Then
  34.     Set objShell = WScript.CreateObject("WScript.Shell")
  35.     objShell.Run("%comspec% /K C:\Scripts\Machine\b.bat"), 1, True
  36.   ElseIf IP_Address >= ip2num("10.100.60.1") _
  37.     And IP_Address <= ip2num("10.100.60.254") Then
  38.     Set objShell = WScript.CreateObject("WScript.Shell")
  39.     objShell.Run("%comspec% /K C:\Scripts\Machine\t.bat"), 1, True
  40.   ElseIf IP_Address >= ip2num("10.100.70.1") _
  41.     And IP_Address <= ip2num("10.100.70.254") Then
  42.     Set objShell = WScript.CreateObject("WScript.Shell")
  43.     objShell.Run("%comspec% /K C:\Scripts\s.bat"), 1, True
  44.   End If
  45. End If
  46.  
  47. Function GetIP()
  48.   Dim ws : Set ws = CreateObject("WScript.Shell")
  49.   Dim fso : Set fso = CreateObject("Scripting.FileSystemObject")
  50.   Dim TmpFile : TmpFile = fso.GetSpecialFolder(2) & "/ip.txt"
  51.   Dim ThisLine, IP
  52.   If ws.Environment("SYSTEM")("OS") = "" Then
  53.     ws.run "winipcfg /batch " & TmpFile, 0, True
  54.   Else
  55.     ws.run "%comspec% /c ipconfig > " & TmpFile, 0, True
  56.   End If
  57.   With fso.GetFile(TmpFile).OpenAsTextStream
  58.     Do While NOT .AtEndOfStream
  59.       ThisLine = .ReadLine
  60.       If InStr(ThisLine, "Address") <> 0 Then IP = Mid(ThisLine, InStr(ThisLine, ":") + 2)
  61.     Loop
  62.     .Close
  63.   End With
  64.   'WinXP (NT? 2K?) leaves a carriage return at the end of line
  65.   If IP <> "" Then
  66.     If Asc(Right(IP, 1)) = 13 Then IP = Left(IP, Len(IP) - 1)
  67.   End If
  68.   GetIP = IP
  69.   fso.GetFile(TmpFile).Delete 
  70.   Set fso = Nothing
  71.   Set ws = Nothing
  72. End Function
  73.  
  74. Public Function ip2num(ip)
  75.     Dim i, a, N
  76.     a = Split(IP, ".")
  77.     N = CDbl(0)
  78.     For i = 0 To UBound(a)
  79.       N = N * 256 + a(i)
  80.     Next
  81.     ip2num = N
  82. End Function
  83.  
Aug 25 '10 #1
1 4392
Peter Duckberg
2 New Member
Turns out this error was caused by ipv6. The script was correct, but the format of the IP on a different adapter had changed. Disabling Teredo and ISATAP adapters fixed it.
Aug 30 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
2894
by: amitbadgi | last post by:
I am getting teh following error while converting an asp application to asp.net, Exception Details: System.Runtime.InteropServices.COMException: Type mismatch. Source Error: Line...
0
3970
by: Stealth3si | last post by:
I hope this is the right thread /forum to place this topic in. I'm trying to execute a .vbs file (double-click) on Windows 2000 Advanced Server with Service Pack 4 (on administrator account) and...
1
4744
by: Osoccer | last post by:
...to a different folder and in the relocated file concatenates all of the lines in one long string with a space between each line element. Here is a fuller statement of the problem: I need a...
1
3050
by: ApexData | last post by:
Access2k I WAS getting the following error when using the MID function: Run Time Error '13' Type Mismatch I have a new single form, unbound with 1-button on it that uses the following code:...
1
3577
by: NarutoFanatic | last post by:
Hi, Im currently updating our email sending functionality of our application. The website is written in classic asp and all codes are really a mess. anyway my problem is that our current process...
10
4529
by: dstorms | last post by:
Hi, I'm trying to create a button on a form that: 1. Takes the ComputerID from the form linked to Table 1, 2. Checks Table 2 for a matching ComputerID, and 3. Opens the query qryEditData, and...
3
18093
FishVal
by: FishVal | last post by:
Windows Script Host Object library. Full name: Windows Script Host Object Model LibName: IWshRuntimeScripting Location: ...\WINDOWS\system32\wshom.ocx The present tip is closely related to...
2
5574
DonRayner
by: DonRayner | last post by:
This one has me stumped. I'm getting a "Type Mismatch" error on one of my forms when it's being opened. It's hapening before the forms "On Open" event, I stuck a msgbox in there to check and I'm...
1
2113
by: kmeistrmuffinmang | last post by:
Hi am new to script with WSH. Can anybody help fin out how to connect to a PostgreSQL database using WSH? Thank you, Kmeistrmuffinmang
8
5065
by: shalskedar | last post by:
For r = 2 To 28 Do While Len(Range("A" & r).Formula) > 0 rs.AddNew rs.Fields(0) = Range("A" & r).Value rs.Fields(1) = Range("C" & r).Value 'Debug.Print r & ":(" & Range("D" & r).Value & ")"...
0
7086
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7280
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6991
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7462
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5014
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3167
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3154
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1512
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
382
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.