Map Network Drive

Please use the script to map network drive on your local machine

import ctypes
class disable_file_system_redirection:
    _disable = ctypes.windll.kernel32.Wow64DisableWow64FsRedirection
    _revert = ctypes.windll.kernel32.Wow64RevertWow64FsRedirection
    def __enter__(self):
        self.old_value = ctypes.c_long()
        self.success = self._disable(ctypes.byref(self.old_value))
    def __exit__(self, type, value, traceback):
        if self.success:

import subprocess
DriveLetter = 'T: '
SharedNetworkPath = r'\\WINDOWS1032BIT\71b740342fd42e68d06f\Sandbox'
pObj = subprocess.Popen('net use '+DriveLetter+' '+SharedNetworkPath+' /persistent:yes', stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
res = pObj.communicate()
retCode = pObj.returncode
if retCode == 0:
    print res[0]
    print res[1]

Sample Output:

Map Network Drive.PNG

Not to “zombie” an older thread, will this be sufficient to check weekly and ensure that a network drive stays mapped?

Hi @cfdff86

It should be changed to Custom monitoring Script. We will update you once script is completed

Thank you

Hi @cfdff86
I have completed the script ,please refer the json file

please ensure that you need to give that “Drive letter” and also when the drive is mapped , the Alert status will be in OFF state.
Once the mapped drive is removed, the Alert status goes to ON state and you will get an alert.

DriveLetter = 'P: ’ # Enter the Drive letter to check the mapping Status.

Thank you

20180207-map-network-drive.json (1.69 KB)