We've still got several users that have admin rights (not for long I hope) but I'm finding several system drives shared out. I want to run this at login to find out if the c:\ is shared and exclude the admin share. I'd then delete the key in lanmanserver which is not a problem. The problem I'm having is how do I discover the share name of the share that isn't the c$ share? Here is what I have so far:
Code:
$Shares = GetObject("winmgmts:").ExecQuery("Select * from Win32_Share where Path <> NULL")
For Each $Share in $Shares
If $Share.Path="c:\" And $Share.Name <> "c$$"
Shell calc.exe
If @ERROR <> 0
? "Error Encountered: " + @SERROR
EndIf
EndIf
Next
_________________________
I could have made a neat retort but didn't, for I was flurried and didn't think of it till I was downstairs.
-Mark Twain