\\testsercver4\trymeout$
BUILTIN\Administrators Full Control
I need to match to a server and a specified share and print out all
the permissions just for that share. The .split("\n") spliuts it on
the newline, but how can I get all the information in between the new
lines.
I need \\testserver2 with all it's permissions and ignore the rest.
.split("\n\n") will divide the output into groups split by a blank line.
Then you can match on the start of the string to find the one you want.
#sharelist = `srvcheck \\\\testserver`
sharelist = <<EOS
\\\\testserver1\\test
domain\\user1 Full Control
Domain\\Admin Full Control
Domain\\chuser Read
Everyone Read
domain\\ysergeb Read
\\testsercver4\trymeout$
BUILTIN\Administrators Full Control
I need to match to a server and a specified share and print out all
the permissions just for that share. The .split("\n") spliuts it on
the newline, but how can I get all the information in between the new
lines.
A small note, but that first line is totally unnecessary. You don't
need to 'declare' a variable to be of a particular type before
assigning it. What you have above is similar to:
foo = 12
foo = 'hello world'
The value in your first assignment (a new, empty array instance) is
totally discarded when you then assign the SHARES constant to a
completely different array.
···
On Feb 7, 8:02 am, "anon1m0us" <anon1m...@yahoo.com> wrote:
I am running a server utility that allows me to view server shares and
permissions.
The command I am using is:
SHARES=Array.new
SHARES=`srvcheck \\\\testserver.split("\n")
Note that ^ and $ match start and end of line anywhere within the string,
not just the start and end of the string.
Here find_share() also strips off the sharename, leaving just the users and
their rights, but you can change this by moving the capture parentheses in
the regexp if you wish.