Hi there,
I have been racking my brain about how to get persitent drives to delete with a login script. My scenario is that Say a user is added to a network drive and its mapped persistently. If that user is moved out of that AD security group i want a piece of code to delete and remove the previously mapped persistent drive.
I cant seem to get the sequence right for removing the drive, and thats what i need help with.
Heres my code:
#include <AD\AD.au3>
func mapdrives()
_AD_Open()
if _AD_IsMemberOf("Security Group") Then
MapDrive()
EndIf
_AD_Close()
EndFunc
;map drive functions
Func MapDrive()
DriveMapDel("Q:")
DriveMapAdd("Q:","\\server\mapdrive",$DMA_PERSISTENT)
EndFunc
Do i need to add in a different else statement for drivemapdel to clear off the old persistent drive?