Page 1 of 1 1
Topic Options
#12086 - 2001-09-03 02:57 PM How to set permission over a share that's not reachable?
Anonymous
Unregistered


Hi, I got a problem that I cannot reach a share if the permission is only set to the user.
Manually I can change the permission, but is there a way I can do this with a script?

this script works only if I can reach the share:
=====================================
IF EXIST("\\server1\share1\" + "%USERNAME%") = 1
USE Z: /D
USE Z: "\\server1\share1\" + "%USERNAME%"
Shell '%comspec% /c C:\TEMP\TOOLS\XCACLS.EXE Z: /Y /T /R "domain\Domain admins"'
========================================

/edit:

I've tried something like this:
===================
Shell '%comspec% /c C:\TEMP\TOOLS\XCACLS.EXE ""\\server\share1\" + "%USERNAME%"" /Y /T /R "domain\Domain admins"'
===================
It doesn't work.
Tnx.

[ 03 September 2001: Message edited by: Indra ]

[ 03 September 2001: Message edited by: Indra ]

Top
#12087 - 2001-09-04 05:23 PM Re: How to set permission over a share that's not reachable?
mvdw Offline
Starting to like KiXtart

Registered: 2001-05-01
Posts: 124
Loc: Voorburg, Netherlands
Hi Indra,

you have just mentioned something we have been discussing/researching quite intensively here on the board.

in short yes, you can do it with either RMTSHARE.EXE (from the reskit, see reskit documentation for details) or you could start scripting with use of WMI. This would mean however, quite heavy scripting and some prerequisites on the servers that contain the shares.

do a search on the board (scripts forum) on wmi or share permissions...


good luck !

Ciao,
Maarten

_________________________
rgrds, Maarten

Top
#12088 - 2001-09-04 11:50 PM Re: How to set permission over a share that's not reachable?
Anonymous
Unregistered


Hi,

Just come to reliaze how stupid I've been

This is what I shoud do:

================================
IF EXIST("\\server1\share1\" + "%USERNAME%") = 1
USE Z: /D
USE Z: "\\server1\share1"
Shell '%comspec% /c C:\TEMP\TOOLS\XCACLS.EXE "Z:\%username%" /Y /T /R "domain\Domain admins"'
=====================================

This works!

I haven't been able to look that other topic...been busy on my work. Gonna look for it now.

Cheers

/Edit:
Mvdw: the topic that you mention....wow!!!! that's certainly waaay out of my league right now lol
I just wrote my first script and today I finished it. Took me some time but I'm getting there

Please see my script here under and any remark is welcome. Uhm...it's a long script so I'm gonna post it on a clean sheet.

[ 05 September 2001: Message edited by: Indra ]

Top
#12089 - 2001-09-05 12:33 AM Re: How to set permission over a share that's not reachable?
Anonymous
Unregistered


It starts with a batch file, which calls the kix32 scripts.


The whole thing starts with "migrate <username>"

(Migrate.bat)
====================================
@echo off

:setuser
IF "%1"=="" GOTO ERROR
set username=%1

C:\TEMP\TOOLS\KIX32.EXE first.scr
GOTO FINISH

:ERROR
echo ********************
echo the right syntax is
echo migrate <username>
echo for sample "migrate ee00430
echo ********************

Goto END

:FINISH
echo *********************
echo migration succesful!!
echo *********************

:END

====================================


(first.scr)
====================================
USE B: /D
USE B: "\\distrsrv\USERDATA\" + "%USERNAME%"
Shell '%comspec% /c md "B:\Application Data\Lotus\Notes"'
Shell '%comspec% /c md "B:\My Documents"'

USE Z: /D
USE Z: "\\server1\USERDATA\" + "%USERNAME%"

Shell '%comspec% /c C:\TEMP\TOOLS\ROBOCOPY.EXE "Z:\NOTES" "B:\APPLICATION DATA\LOTUS\NOTES" /E'
SHELL 'c:\winnt\system32\cmd.exe /c COPY "Z:\Notes.ini" "B:\Applic~1\LOTUS\NOTES\notes.ini" /Y'

CALL C:\TEMP\TOOLS\second.scr

:end
====================================


(second.scr)
====================================
USE B: /D
USE B: "\\distrsrv\USERDATA\" + "%USERNAME%"

USE Z: /D
USE Z: "\\server4\USERPROF\" + "%USERNAME%"
Shell '%comspec% /c md "B:\BACKUP"'

Shell '%comspec% /c C:\TEMP\TOOLS\ROBOCOPY.EXE "Z:\FAVORITES" "B:\BACKUP\FAVORITES" /E'
Shell '%comspec% /c C:\TEMP\TOOLS\ROBOCOPY.EXE "Z:\COOKIES" "B:\BACKUP\COOKIES" /E'

Shell '%comspec% /c C:\TEMP\TOOLS\XCOPY.EXE "Z:\DESKTOP\*.DOC" "B:\MY DOCUMENTS" /E /H /Y'
Shell '%comspec% /c C:\TEMP\TOOLS\XCOPY.EXE "Z:\DESKTOP\*.PPT" "B:\MY DOCUMENTS" /E /H /Y'
Shell '%comspec% /c C:\TEMP\TOOLS\XCOPY.EXE "Z:\DESKTOP\*.TXT" "B:\MY DOCUMENTS" /E /H /Y'
Shell '%comspec% /c C:\TEMP\TOOLS\XCOPY.EXE "Z:\DESKTOP\*.MD?" "B:\MY DOCUMENTS" /E /H /Y'
Shell '%comspec% /c C:\TEMP\TOOLS\XCOPY.EXE "Z:\DESKTOP\*.XLS" "B:\MY DOCUMENTS" /E /H /Y'
Shell '%comspec% /c C:\TEMP\TOOLS\XCOPY.EXE "Z:\DESKTOP\*.ZIP" "B:\MY DOCUMENTS" /E /H /Y'

Shell '%comspec% /c C:\TEMP\TOOLS\XCOPY.EXE "Z:\PERSONAL\*.DOC" "B:\MY DOCUMENTS" /E /H /Y'
Shell '%comspec% /c C:\TEMP\TOOLS\XCOPY.EXE "Z:\PERSONAL\*.PPT" "B:\MY DOCUMENTS" /E /H /Y'
Shell '%comspec% /c C:\TEMP\TOOLS\XCOPY.EXE "Z:\PERSONAL\*.TXT" "B:\MY DOCUMENTS" /E /H /Y'
Shell '%comspec% /c C:\TEMP\TOOLS\XCOPY.EXE "Z:\PERSONAL\*.MD?" "B:\MY DOCUMENTS" /E /H /Y'
Shell '%comspec% /c C:\TEMP\TOOLS\XCOPY.EXE "Z:\PERSONAL\*.XLS" "B:\MY DOCUMENTS" /E /H /Y'
Shell '%comspec% /c C:\TEMP\TOOLS\XCOPY.EXE "Z:\PERSONAL\*.ZIP" "B:\MY DOCUMENTS" /E /H /Y'

CALL C:\TEMP\TOOLS\third.scr

:END
====================================


(third.scr)
====================================
USE B: /D
USE B: "\\distrsrv\USERDATA\" + "%USERNAME%"

IF EXIST("\\server6\department1\" + "%USERNAME%") = 1
USE Z: /D
USE Z: "\\server6\department1"
Shell '%comspec% /c C:\TEMP\TOOLS\XCACLS.EXE "Z:\%username%" /Y /T /R "Domain\Domain admins"'
Shell '%comspec% /c C:\TEMP\TOOLS\ROBOCOPY.EXE "Z:\%username%" "B:\My Documents" /E'

Shell '%comspec% /c C:\TEMP\TOOLS\XCACLS.EXE B: /Y /T /R "Domain\Domain admins"'
Shell '%comspec% /c C:\TEMP\TOOLS\XCACLS.EXE B: /Y /T /E /G "Domain\%username%:C"'

ELSE ""
ENDIF


IF EXIST("\\server6\department2\" + "%USERNAME%") = 1
USE Z: /D
USE Z: "\\server6\department2"
Shell '%comspec% /c C:\TEMP\TOOLS\XCACLS.EXE "Z:\%username%" /Y /T /R "Domain\Domain admins"'
Shell '%comspec% /c C:\TEMP\TOOLS\ROBOCOPY.EXE "Z:\%username%" "B:\My Documents" /E'

Shell '%comspec% /c C:\TEMP\TOOLS\XCACLS.EXE B: /Y /T /R "Domain\Domain admins"'
Shell '%comspec% /c C:\TEMP\TOOLS\XCACLS.EXE B: /Y /T /E /G "Domain\%username%:C"'

ELSE ""
ENDIF

this goes on and on, had to do this for 30 departments


:END

================================

I just wish I can make this shorter...ah well...I still have to built in some more "if end else" but this works so I can go further

Any comment I appreciate it.

Cheers.

Top
#12090 - 2001-09-05 12:43 AM Re: How to set permission over a share that's not reachable?
Anonymous
Unregistered


forgot to tell something,

We're migrating all workstations from NT4 to W2K. In the "old" situation a user has full control over his home dir and sometimes they set the permission close for everybody (domain admins) except for them.
So if I want to map the home dir in the dos prompt "net use * \\server\share\ee00945" then I get something like "network name not found" or something like that.
Therefor I need to set the permission right with xcacls.exe (in the third script) to be able to copy their data to their new home dir.

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 2220 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.054 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