I have a vbs script that gives me the exact information I need. But I would like to integrate it into a java program I have already coded. (I know java better than vbs) I can't seem to find a way to "port" the function of this script to java.
This is the code that I would like to integrate into my java code. All it does is to enumerate the network drives the pc has connected. I am looking for a specific drive mapping and then verifying the server it is connected to. If that is not possible then is there a way to pull the output of this script into java? "Reading the stack" is something I hear to try but I don’t know how this would be done.
Thanks in advance for the help.
Code:
Option Explicit
Dim objNetwork, objDrive, intDrive, intNetLetter
' This is the heart of the script
' Here is where objDrive enumerates the mapped drives
Set objNetwork = CreateObject("WScript.Network")
Set objDrive = objNetwork.EnumNetworkDrives
' Extra section to troubleshoot
If objDrive.Count = 0 Then
WScript.Echo "No Drives Mapped "
Wscript.Quit(0)
End If
' Here is the where the script reads the array
For intDrive = 0 to objDrive.Count -1 Step 2
intNetLetter = IntNetLetter +1
WScript.Echo "UNC Path " & intDrive & " - " & objDrive.Item(intDrive)_
& " Mapped drive No : " & objDrive.Item(intDrive +1)
Next
Wscript.Quit(1)
This is the code that I would like to integrate into my java code. All it does is to enumerate the network drives the pc has connected. I am looking for a specific drive mapping and then verifying the server it is connected to. If that is not possible then is there a way to pull the output of this script into java? "Reading the stack" is something I hear to try but I don’t know how this would be done.
Thanks in advance for the help.