-1

I'm writing a .vbs script for an application on Windows. The problem is that the ArrayList is used inside the script. MDSN states that the .NET Framework 4.8 installed is sufficient to use ArrayList. The problem is this - I tested this script on two machines: one running Windows 10, and the other running Windows Server 2016. On Windows 10 everything works fine, but on Windows Server 2016 it throws up the error ".NET Framework 3.5 is not installed" (or something like that). Moreover, this error appeared only once during the first attempt to run the script and on the line with the creation of the ArrayList object. In the end, I was able to solve the problem by manually enabling the .NET Framework 3.5 feature on the Windows Server 2016 machine. The problem is that performing such actions seems too cumbersome for our application users. In theory, the script should work simply after installing the .NET Framework 4.8 (which is a prerequisite for our application to work), but it does not work and I cannot understand why. I tried searching for information on this, and found some posts about problems working with ArrayList with .NET other than 3.5. I already use late binding in my script (if I understand correctly, this is creating an object via CreateObject("System.Collections.ArrayList")), but this does not help. Also, the machine on WServer 2016 has .NET Framework 4.8 installed (I looked at the version through the registry according to the instructions on MDSN), but until I enabled .NET 3.5, the script did not work. What could be the problem causing ArrayList not to work with .NET Framework 4.8? Could this be some local issue with Windows Server 2016?

3
  • VBScript is in the process of deprecation; it might not be worth solving this, but instead: finding a different/alternative solution Commented Oct 21, 2024 at 12:41
  • 1
    I don't have a solution, but I had the same problem. I solved it my enabling .Net framework 3.5 where needed, but it would be nice if there would be a better solution. Commented Oct 21, 2024 at 12:48
  • @MarcGravell unfortunately, using vbs is not my decision, so i can't( Commented Oct 21, 2024 at 12:48

1 Answer 1

1

As a slightly alternative solution, there is an option to use not an ArrayList, but a Dictionary. VBS dictionary also has the Exist and Remove functions (personally, I was missing them in a regular Array), but this is still a slightly different way to solve the problem

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.