Page 1 of 1 1
Topic Options
#117603 - 2004-04-09 01:28 AM Add permissions to directory
skiff Offline
Fresh Scripter

Registered: 2003-07-18
Posts: 12
Trying to add permissions to a couple directorys on anyone's w2k workstations where the NTFS directory exists.

Code:

$DOMAIN = TPE

IF EXIST ("C:\Program Files\The Produce Exchange\TPEAllocator\buffers")
SHELL RUN 'XCACLS "C:\Program Files\The Produce Exchange\TPEAllocator\buffers" /C /T /G "$DOMAIN\Everyone":F
ENDIF

IF EXIST ("C:\Program Files\The Produce Exchange\TPEAllocator\XML")
SHELL RUN 'XCACLS "C:\Program Files\The Produce Exchange\TPEAllocator\XML" /C /T /G "$DOMAIN\Everyone":F
ENDIF

IF EXIST ("C:\Program Files\The Produce Exchange\TPEAllocator\XML\Saved")
SHELL RUN 'XCACLS "C:\Program Files\The Produce Exchange\TPEAllocator\XML\Saved" /C /T /G "$DOMAIN\Everyone":F
ENDIF



got this from an example from a old post but this script isnt working. no errors are being displayed.


Edited by skiff (2004-04-09 08:39 PM)

Top
#117604 - 2004-04-09 04:54 AM Re: Add permissions to directory
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
See the RUN/SHELL FAQ in the FAQ Forum and read the KiXtart Manual under RUN and SHELL You cannot combine them the way you have them.
_________________________
There are two types of vessels, submarines and targets.

Top
#117605 - 2004-04-09 07:12 PM Re: Add permissions to directory
ChristopheM Offline
Hey THIS is FUN
*****

Registered: 2002-05-13
Posts: 311
Loc: STRASBOURG, France
Look at FileAcl utility (last version is 2.8.0.3).

FILEACL v 2.8.0

there are many options (like inherit permissions for Windows 2000 and upper) and it seems to be so good that you can find it on the Microsoft web site.
_________________________
Christophe

Top
#117606 - 2004-04-09 08:36 PM Re: Add permissions to directory
skiff Offline
Fresh Scripter

Registered: 2003-07-18
Posts: 12
So after reading the SHELL\RUN in the FAQ. i know i need to run one or the other. but when reading the KIX manual i think i need to run just the Shell command.

Adding Folder Permissions

States his issue was resolved with the run command.
Using the RUN on my script doesn't resolve the issue.
any pointers?

Top
#117607 - 2004-04-09 08:50 PM Re: Add permissions to directory
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
There are some missing closing quotes on the top script you posted. Try this out...

Code:
$DOMAIN = "TPE"


IF EXIST ("C:\Program Files\The Produce Exchange\TPEAllocator\buffers")
SHELL '%comspec% /c XCACLS "C:\Program Files\The Produce Exchange\TPEAllocator\buffers" /C /T /G "'+$DOMAIN+'\Everyone":F'
ENDIF
IF EXIST ("C:\Program Files\The Produce Exchange\TPEAllocator\XML")
SHELL '%comspec% /c XCACLS "C:\Program Files\The Produce Exchange\TPEAllocator\XML" /C /T /G "'+$DOMAIN+'\Everyone":F'
ENDIF
IF EXIST ("C:\Program Files\The Produce Exchange\TPEAllocator\XML\Saved")
SHELL '%comspec% /c XCACLS "C:\Program Files\The Produce Exchange\TPEAllocator\XML\Saved" /C /T /G "'+$DOMAIN+'\Everyone":F'
ENDIF



Not sure if you really need the quotes around the DOMAIN\Everyone part or not though. That may be screwing you up as well.

Top
#117608 - 2004-04-10 05:58 PM Re: Add permissions to directory
skiff Offline
Fresh Scripter

Registered: 2003-07-18
Posts: 12
With or without quotes around the DOMAIN\EVERYONE get error message
No mapping between account name and security Ids was done

Does it matter that I am working on a native w2k domain?

Top
#117609 - 2004-04-10 06:01 PM Re: Add permissions to directory
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Repost what code you have now. As Shane said, your first post is missing the closing quote.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#117610 - 2004-04-10 06:03 PM Re: Add permissions to directory
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Also, Everyone is a well known group and should not include the domain name.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#117611 - 2004-04-10 06:12 PM Re: Add permissions to directory
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Did you even test the command from a DOS prompt before trying to script it?
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#117612 - 2004-04-10 06:37 PM Re: Add permissions to directory
skiff Offline
Fresh Scripter

Registered: 2003-07-18
Posts: 12
Code:
  $DOMAIN = "TPE"


IF EXIST ("C:\Program Files\The Produce Exchange\TPEAllocator\buffers")
SHELL '%comspec% /c XCACLS "C:\Program Files\The Produce Exchange\TPEAllocator\buffers" /C /T /G '+$DOMAIN+'\Everyone:F'
ENDIF
IF EXIST ("C:\Program Files\The Produce Exchange\TPEAllocator\XML")
SHELL '%comspec% /c XCACLS "C:\Program Files\The Produce Exchange\TPEAllocator\XML" /C /T /G '+$DOMAIN+'\Everyone:F'
ENDIF
IF EXIST ("C:\Program Files\The Produce Exchange\TPEAllocator\XML\Saved")
SHELL '%comspec% /c XCACLS "C:\Program Files\The Produce Exchange\TPEAllocator\XML\Saved" /C /T /G '+$DOMAIN+'\Everyone:F'
ENDIF



If i remove the '+$DOMAIN+ I get unknown command error

Top
#117613 - 2004-04-10 07:01 PM Re: Add permissions to directory
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
I will ask you again, did you even test the command from a DOS prompt before trying to script it? It is not sufficient to just remove the '+$DOMAIN+ as it would still leave the backslash.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#117614 - 2004-04-10 11:19 PM Re: Add permissions to directory
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
OK, I got your PMs...

Thought I should post here cuz then others that read this thread could benefit from a complete answer.

Adding /Y should silence the prompt.
Code:

Break On
Shell 'xcacls "C:\New Folder" /Y /C /T /G Everyone:f'
@error ?
@Serror ?
Shell 'xcacls "C:\New Folder (2)" /Y /C /T /G Everyone:f'
@error ?
@Serror ?
Shell 'xcacls "C:\New Folder (3)" /Y /C /T /G Everyone:f'
@error ?
@Serror ?



Make sure you don't put it the /Y after the /G?
/G Everyone:f is one parm... has to be kept together.

You might want to include %comspec% so that you can send the result to the bit bucket.
Shell '%comspec% /c xcacls "C:\New Folder" /Y /C /T /G Everyone:f 1>nul 2>&1'


_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#117615 - 2004-04-10 11:22 PM Re: Add permissions to directory
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Oh, one more thing... your title is wrong Add permissions to directory

It does not ADD, it replaces perms!
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#117616 - 2004-04-12 09:00 AM Re: Add permissions to directory
skiff Offline
Fresh Scripter

Registered: 2003-07-18
Posts: 12
Code:
      

IF EXIST ("C:\Program Files\The Produce Exchange\TPEAllocator\buffers")
Shell '%comspec% /c XCACLS "C:\Program Files\The Produce exchange\TPEAllocator\buffers" /Y /C /T /G Everyone:F 1>nul 2>&1'
ENDIF
IF EXIST ("C:\Program Files\The Produce Exchange\TPEAllocator\XML")
Shell '%comspec% /c XCACLS "C:\Program Files\The Produce exchange\TPEAllocator\XML" /Y /C /T /G Everyone:F 1>nul 2>&1'
ENDIF
IF EXIST ("C:\Program Files\The Produce Exchange\TPEAllocator\XML\Saved")
Shell '%comspec% /c XCACLS "C:\Program Files\The Produce exchange\TPEAllocator\XML\Saved" /Y /C /T /G Everyone:F 1>nul 2>&1'
ENDIF



this is final Code. thanks for all the help LES

Top
Page 1 of 1 1


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

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

Generated in 0.067 seconds in which 0.027 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