Microsoft Virtualization Discussions

how to avoid suprise removal of disk on host when using remove-nclunmap


Hey guys, 


I am currently working on a powershell module which would kinda give the same functionality that snapdrive would give us for lun management. (snapcenter would be a better option but this is not something which we have in place anyway). 


Now, I have run into a problem where at a certain point i just want to disconnect a lun by using the powershell toolkit . I am using remove-nclunmap for this but this ofcourse has the effect that my host suddenly looses its connection to that particular disk. 


And well,  the host is not that happy about it as it seems that no diskrelated diskcommando's are possible untill the host validates the suprise removal of the disk. 


I have also made sure that the volume is first dismounted from the system before removing the lunmap, but he keeps giving me a delay of 1-2 minutes before i can actually procceed with doing anything diskrelated. 


Do you guys have an idea how to actually solve this problem? 

Thanks in advance





The powershell toolkit does not have any other command that map more to snapdrive beside the one you are using or can find in the TR below:


Add-N?LunMap Maps the LUN to all the initiators in the specified initiator group

Remove-N?LunMap Reverses the effect of Add-NaLunMap on the specified LUN for
the specified group


When issuing the remove-Nlunmap the behavior you seeing in your host is expected as this ID 157 was introduced in windows 8.1 and server 2012 R2 to log a record of a disk disappearing.