Issuing the 'Net Use' command f开发者_StackOverflow中文版rom within the CMD prompt shows 50+ disconnected remote IPC$ shares in the following format:
where Name =
Status Local Remote Network
Disconnected \MACHINE\IPC$ Microsoft Windows Network
How do I enumerate through the list of these shares and kill them if I wanted to write a c# app to do so?
I read somewhere using WMI in conjunction with "win32_share" would work however, it's not returning the expected remote shares.
Any assistance on this would be greatly appreciated.
Thank you.
you must use the NetShareEnum
WinApi function to get the list of shares and NetShareDel
to remove the shared reources.
Here you have the Pinvoke for NetShareEnum
with a sample and the NetShareDel
as well.
精彩评论