Is it possible to determine if a shared folder (from a USB drive connected to a Guest Operating System) is accessible within the Host environment?
Example: The USB drive is connected to the Guest OS and is accessible via File Explorer from the Host OS (Windows 10). The challenge is when the USB drive is disconnected from the Guest OS. The Host OS shows the shared folder but it is greyed out. The test here is whether or not the USB drive is connected.
I appreciate your thoughts.
VM Shared Folders
-
- GoldLounger
- Posts: 2631
- Joined: 26 Jan 2010, 16:31
- Location: Southern California
VM Shared Folders
Regards,
John
John
-
- GoldLounger
- Posts: 2631
- Joined: 26 Jan 2010, 16:31
- Location: Southern California
Re: VM Shared Folders
I came up with a solution. If the USB drive is connected the "Type" shows up as a "File Folder" otherwise as a "File".
Code: Select all
Sub Test_Folder_Exists()
Set FSO = CreateObject("Scripting.FileSystemObject")
Dim Fldr_name As String
Fldr_name = "MyFolder"
If FSO.FolderExists(Fldr_name) = True Then
MsgBox "Folder Exists!"
Else
MsgBox "Connect Drive"
End If
End Sub
Regards,
John
John
-
- Administrator
- Posts: 78493
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands