Page 1 of 1 1
Topic Options
#152683 - 2005-12-01 08:34 PM find system shares
brewdude6 Offline
Hey THIS is FUN

Registered: 2000-10-21
Posts: 280
Loc: Nashville, TN
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

Top
#152684 - 2005-12-01 08:39 PM Re: find system shares
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
look fine to me.
btw, all strings MUST be inside quotes.

thus your shell line should be:
Shell "calc.exe"
_________________________
!

download KiXnet

Top
#152685 - 2005-12-01 08:42 PM Re: find system shares
brewdude6 Offline
Hey THIS is FUN

Registered: 2000-10-21
Posts: 280
Loc: Nashville, TN
I probably wasn't very clear in my question. How would I discover what the share name is of the share that is not the C$ share? I need to know the name so I can delete that key in the registry.
_________________________
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

Top
#152686 - 2005-12-01 09:09 PM Re: find system shares
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
tried $Share.Name already?

Can't tell exactly why you ask as you already use it

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$$"
$Share.Name ?
EndIf
Next



Edited by Jochen (2005-12-01 09:19 PM)
_________________________



Top
#152687 - 2005-12-01 09:18 PM Re: find system shares
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
or $share.sharename
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#152688 - 2005-12-01 09:25 PM Re: find system shares
brewdude6 Offline
Hey THIS is FUN

Registered: 2000-10-21
Posts: 280
Loc: Nashville, TN
You can't figure out why I'm doing that because I asked before thinking about my question. Thanks and sorry.
_________________________
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

Top
#152689 - 2005-12-01 09:26 PM Re: find system shares
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
you're welcome
_________________________



Top
#152690 - 2005-12-02 08:36 AM Re: find system shares
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
so nashville, did I get your question?
_________________________
!

download KiXnet

Top
Page 1 of 1 1


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 525 anonymous users online.
Newest Members
batdk82, StuTheCoder, M_Moore, BeeEm, min_seow
17885 Registered Users

Generated in 0.071 seconds in which 0.037 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org