D
Daniel
Any ideas why the below function does not work? It just returns the
drives of the local computer not the remote one. I don't think it is
permissions because I am in the Admins group on the remote computer.
Private Function GetRemoteDrives(ByVal RemoteServer As String) As String
Dim moMOS As System.Management.ManagementObjectSearcher
Dim moObject As System.Management.ManagementObject
Dim moQuery As System.Management.ObjectQuery
Dim moResults As System.Management.ManagementObjectCollection
Dim moScope As System.Management.ManagementScope
Dim AllDrives As String = Nothing
moScope = New Management.ManagementScope("\\" & RemoteServer)
moQuery = New Management.ObjectQuery("Select Name from Win32_LogicalDisk
where DriveType=3")
moMOS = New Management.ManagementObjectSearcher(moScope, moQuery)
moResults = moMOS.Get
For Each moObject In moResults
AllDrives = AllDrives + moObject("Name") & "|"
Next
Return Strings.Left(AllDrives, Len(AllDrives) - 1)
End Function
drives of the local computer not the remote one. I don't think it is
permissions because I am in the Admins group on the remote computer.
Private Function GetRemoteDrives(ByVal RemoteServer As String) As String
Dim moMOS As System.Management.ManagementObjectSearcher
Dim moObject As System.Management.ManagementObject
Dim moQuery As System.Management.ObjectQuery
Dim moResults As System.Management.ManagementObjectCollection
Dim moScope As System.Management.ManagementScope
Dim AllDrives As String = Nothing
moScope = New Management.ManagementScope("\\" & RemoteServer)
moQuery = New Management.ObjectQuery("Select Name from Win32_LogicalDisk
where DriveType=3")
moMOS = New Management.ManagementObjectSearcher(moScope, moQuery)
moResults = moMOS.Get
For Each moObject In moResults
AllDrives = AllDrives + moObject("Name") & "|"
Next
Return Strings.Left(AllDrives, Len(AllDrives) - 1)
End Function