Page 2 of 2 <12
Topic Options
#72462 - 2003-01-08 11:54 PM Re: Extract part of a string
Anonymous
Unregistered


I'll try that script, thanks! And yes, we're going from Windows NT 4.0 to Windows 2000. Getting new servers and moving the data from one server to the other. Besides, what's wrong with the hardest way? :-p Ha!!! Just kidding!
Top
#72463 - 2003-01-09 12:03 AM Re: Extract part of a string
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Please fill in the correct details.

You have an OLD domain "D01".
You now have a new domain "BIO".
Your users now have an OLD D01 account and a new BIO account.
You have a server (DC or member server; what domain) that currently has security configured to let D01 account have access.

Do you utilize local group or just place the account in the file system ACL?

Use DumpSec.exe from http://Somarsoft.com to output your current security for analysis.

How many servers need to have security adjusted? How many objects in the file system?
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#72464 - 2003-01-09 12:09 AM Re: Extract part of a string
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Mike:

We're really trying to help you. However, this requires a little bit of work on your part, too. If we ask you to provide details, then i normally do NOT expect a generic one sentence statement like
quote:
moving data from one server to the other
Do you try to copy a complete directory structure form one fileserver to another while preserving the filo permissions? Do you want to transfer the shares, too? Are you switching from a Windows NT-based to main to an Active directory domain?

So, please elaborate in detail what you try to do. I'm sure, Howard will be able to solve your problem with a 5-second solution, right Howard? However, the first task is to properly outline the underlying problem.

And, BTW, yes, you can do it the hard way, however, I will not waste my time on your questions if you're not willing to learn more efficient, syntactically better, and maybe even faster ways to code.
_________________________
There are two types of vessels, submarines and targets.

Top
#72465 - 2003-01-09 12:14 AM Re: Extract part of a string
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
We do this everyday. Just moved all data from an NT4 file server acessed via nt domain accounts in server local groups to a W2K fileserver accessed by W2K AD accounts. The users never new the difference.

We eat companies and give them new NT accounts from our domain, setup a trust from their domain to ours, and adjust ALL security on the old server to give them the same access their old accounts had.

The process is fairly quick, but there is some intial data gathering requirements and teaching that has to be accomplished.

[ 09. January 2003, 01:20: Message edited by: Howard Bullock ]
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#72466 - 2003-01-09 01:13 AM Re: Extract part of a string
Anonymous
Unregistered


Thank you all for your help. I got the script to FINALLY work the way I wanted it to!! I might not be the easiest way and I'm still gonna explore other options, but until then I can say I did it!! The script as is won't make any ACL changes, it will just display the command lines. The actual commands are REMed out until futher testing! Thanks again!!

code:
BREAK ON

$DIR=F:\

SHELL "CMD.EXE /E:1024 /C DIR $DIR *. /AD /B /N > $DIR\DIRS.TXT"
Open(2,"$DIR\DIRS.TXT",4)
WRITELINE (2,"999999999")
CLOSE(2)

$INDEX2 = 0
$COUNT2 = 0

$index = 0 ; This index is used to count directories
$count = 0 ; This count is used to determine how many directories have been changed

SHELL "CMD.EXE /E:1024 /C CACLS $DIR > $DIR\CACLS.TXT"

$DIRLOC = $DIR
Open(1,"$DIR\CACLS.TXT",4)
WRITELINE (1,"THEEND")
CLOSE(1)
Open(1,"$DIR\CACLS.TXT",2)
Open(2,"$DIR\DIRS.TXT",2)
GOTO READACL

:SUBS

$COUNT2 = $COUNT2 + 1
$INDEX2 = $INDEX2 + 1

; This section reads each line of DIRS.TXT file with the directory information in it.

$D = ReadLine(2)
IF $D = "999999999"
Goto Done
ENDIF

; This secition will take the output file with the ACL information
; and wrote THEEND at the end of it to mark the end of the file

$DIRLOC='$DIR'+'$D'
? "$DIRLOC"


$shellstring2='cacls ' + '"$DIRLOC"'+ ' >' + ' "$DIRLOC' + '\CACLS.TXT"'
? "$SHELLSTRING2"
shell '%COMSPEC% /e:1024 /c '+$shellstring2

Open(1,'$DIRLOC' + \CACLS.TXT,4)
WRITELINE (1,"THEEND")
CLOSE(1)
Open(1,$DIRLOC + \CACLS.TXT,2)


; This section reads each line of the CACLS.TXT file with the ACL information in it.
; If the line has D01\ in it, the program will extract the user name or group name
; associated with D01\ and make it the $NAMEGRP variable

:READACL

$X = ReadLine(1)
IF $X = "THEEND"
CLOSE(1)
DEL '$DIRLOC' + '\CACLS.TXT'
Goto SUBS
Endif

IF INSTR ("$X", "EVERYONE")
$Account = split(split($X,":")[0],"\")
$NAMEGRP = LTRIM($Account[0])
GOTO PERMISSION
ENDIF

$S = LEN($DIRLOC + 1)

IF INSTR ("$X", "D01\") <> 0
$userperm=LTRIM(substr($X,$S))
$userperm=split($userperm,':')
$user=$userperm[0]
if instr($user,'\')
$user=split($user,'\')
$NAMEGRP=$user[1]
ENDIF
GOTO PERMISSION
ELSE
GOTO COUNT
ENDIF

:PERMISSION
$P = SUBSTR($X, LEN(RTRIM($X)), 1)

IF $P='N' OR $P='R' OR $P='W' OR $P='C' OR $P='F'

; This section will take the $NAMEGRP variable and add an ACL for the same user or group
; in the BIO domain. Giving that user or group None, Read, Write, Change or Full Control.


$shellstring='cacls ' + '$DIRLOC'+ ' /E /g' + ' BIO\' + '$NAMEGRP' + ':' + '$P'
; shell '%COMSPEC% /e:1024 /c '+$shellstring
? "$shellstring"

ENDIF

:COUNT
$count = $count + 1 ;increase the count of directories
$index = $index + 1 ;increment index for next pass


goto READACL ;loop and read next ACL

CLOSE (1)
CLOSE (2)

:Done

CLOSE (2)
DEL $DIR + 'DIRS.TXT'

? "Done!"
? ""


Top
Page 2 of 2 <12


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

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

Generated in 0.059 seconds in which 0.031 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