Does anyone know how I would go about programming a VB Script to call the DeleteVolumeMountPoint() SDK function?
You can try looking on Microsoft’s website for their Scriptomatic tool. I don’t know if it covers this particular function, but it does come in handy.
You can use the “mountvol” command line tool instead.
Enter “mountvol -?” on the command line for more information on the syntax. Use the WScript.Shell object to run the command from your script.
When playing around, be careful not to delete the mountpoint for the C: drive!
I’ve never called this kind of function from VBScript, but if you have the documentation for making the call, it would be pretty simple to write it in VB and compile it as a DLL you could then call from your VBScript. That is, with minimal VB coding, you could write a DLL wrapper around the DeleteVolumeMountPoint call and use the usual CreateObject command to access your DLL from VBScript.
All good ideas. Thanks.
If you think you might be calling more API functions, it’s probably worthwhile writiting yourself a COM object (very easy in VB6/7 depending which you have access to). Your COM object would then dispatch calls to the appropriate API function:
if option 1
call API function 1
else if option 2
call API function 2
… etc etc …
Of course, for more than two options you’ll probably want a Select…Case.
COM objects are very easy to use from VBScript.