Master-Squirrel
asked on
I try to delete a remote shares by VBS
Greetings, - )
I want to delete a remote share. I started from trying to delete local share with this code:
(look at the code)
This is a part of code (I exclused the part where I write to log file my results).
So when I opened my log file I see that all my shares where found but they are not deleted.
I tried to use "If Err.Number <> 0 Then"
but it didn't help.
I try to run it on MS Vista.
I want to delete a remote share. I started from trying to delete local share with this code:
(look at the code)
This is a part of code (I exclused the part where I write to log file my results).
So when I opened my log file I see that all my shares where found but they are not deleted.
I tried to use "If Err.Number <> 0 Then"
but it didn't help.
I try to run it on MS Vista.
ASKER
Hmmm...It works only on XP. Why?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Great thanks! It works!!
ASKER
That is my code:
Set objWMIService = GetObject("winmgmts:\\.\ro
Set colShares = objWMIService.ExecQuery("S
For Each ShareItem in colShares
ShareItem.Delete
Next