If you read the Change share permissions with RMTSHARE + PowerShell you might miss some information about massive share migration.
With net share and permcopy commands (permcopy can be found in Windows Resource Kit) we will create from commandline the share resources in destination and then clone share permissions from original shares.
First thing we have to do is to export a list of shares from origin server.
It generates a txt with 5 columns tab delimited: sharename, path, type, number of conexions and description, but we only need the first two ones.
With the following batch we will wall through the file, create the shares (first with everyone Full Control permission) and then clone the share permissions from original shares in destination shares.
With net share and permcopy commands (permcopy can be found in Windows Resource Kit) we will create from commandline the share resources in destination and then clone share permissions from original shares.
First thing we have to do is to export a list of shares from origin server.
It generates a txt with 5 columns tab delimited: sharename, path, type, number of conexions and description, but we only need the first two ones.
Shared$ K:\Datos\Shared Financiero$ K:\Datos\Financiero Direccion$ K:\Datos\Direccion Contabilidad$ K:\Datos\Contabilidad
With the following batch we will wall through the file, create the shares (first with everyone Full Control permission) and then clone the share permissions from original shares in destination shares.
@echo off set origin=SERVERFS01 set destination=SERVERFS02 set listfile=listshares.txt REM columns delimiter [tab] For /F "delims= eol=* tokens=1,2" %%i IN (%listfile%) do ( echo ------%%i------- REM create the share net share %%i="%%j" "/GRANT:EVERYONE,FULL" REM copy permissions from origin permcopy \\%origin% %%i \\%destination% %%i )
Comments
Post a Comment