Check availability of mapped network drive
-
- Posts: 16
- Joined: Sun Feb 04, 2007 4:13 pm
Check availability of mapped network drive
I need to check the availability of a folder on a mapped network drive.
I have to use a mapped network drive because this is the method that the software on the server which is causing the problem requires. I cannot use a UNC path.
When I try and create a Folder/File availablility test I can only see the A: C: and D: drives on the server running the Agent, not any mapped network drives. Is there any way to make the mapped network drives show up ?
Will
I have to use a mapped network drive because this is the method that the software on the server which is causing the problem requires. I cannot use a UNC path.
When I try and create a Folder/File availablility test I can only see the A: C: and D: drives on the server running the Agent, not any mapped network drives. Is there any way to make the mapped network drives show up ?
Will
-
- Posts: 2832
- Joined: Tue May 16, 2006 4:41 am
- Contact:
Re: Check availability of mapped network drive
I do not understand why you can not use UNC path. Actually, mapped drive is just a letter assigned to the UNC path.willhartley wrote:I need to check the availability of a folder on a mapped network drive.
I have to use a mapped network drive because this is the method that the software on the server which is causing the problem requires. I cannot use a UNC path.
I assume, HostMonitor is started as service? In such case you will not see any mapped drives, because service is running in its own security context. If you stop the service and start HostMonitor as an application, you will be able to see mapped drives, because in such case HostMonitor uses security context of the logged in user. However, application will not work after you logoff.willhartley wrote:When I try and create a Folder/File availablility test I can only see the A: C: and D: drives on the server running the Agent, not any mapped network drives. Is there any way to make the mapped network drives show up ?
Regards,
Max
-
- Posts: 16
- Joined: Sun Feb 04, 2007 4:13 pm
-
- Posts: 2832
- Joined: Tue May 16, 2006 4:41 am
- Contact:
You may specify particular user account into "Options" > "Service" tab. However, it does not help to see the mapped drives. Why do not you want to use UNC path? You do not know exact path? Other reasons?willhartley wrote:Is it possible to run the service under the context of a particular user ?
Regards,
Max
-
- Posts: 16
- Joined: Sun Feb 04, 2007 4:13 pm
Then you should run HostMonitor as application.
Regards
Alex
Probably you may check that software instead of drive? You may use Process test method to check for running process. Unless this software starts from time to time and should not run all the time?If the Z: drive is not mapped the software generates a runtime error and crashes
Regards
Alex
-
- Posts: 16
- Joined: Sun Feb 04, 2007 4:13 pm
-
- Posts: 2832
- Joined: Tue May 16, 2006 4:41 am
- Contact:
Here's a VBSCript I found to enumerate network drives on a system. You could modify it to suit your needs...
'
' EnumNetworkDrives.vbs - Windows Logon Script
' VBScript to Enumerate Network Drives
'.N.B. This script need mapped drives
' Author Guy Thomas http://computerperformance.co.uk/
' Version 1.8 - April 24th 2005
' -----------------------------------------------------------'
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 "Guy's warning: 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)
' Guy's Script ends here
'
' EnumNetworkDrives.vbs - Windows Logon Script
' VBScript to Enumerate Network Drives
'.N.B. This script need mapped drives
' Author Guy Thomas http://computerperformance.co.uk/
' Version 1.8 - April 24th 2005
' -----------------------------------------------------------'
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 "Guy's warning: 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)
' Guy's Script ends here