::
:: User Share
::
:: This script creates a shared user directory and assigns the correct
:: Permissions
::
:: The command syntax is: usershare {UID} {UserName}
::
:: NOTE: Server ID is hardcoded in three lines
:: Global Administrator's Group is hardcoded in one line
:: Drive letter to the Users folder is hardcoded in one line
@echo off
if not "%2" == "" goto continue
echo.
echo.
echo Command syntax is: usershare {3-4 UID} {6-1-1 UserName}
echo.
echo.
pause
goto end
:continue
@echo on
:: Open a Mapped Drive to the USERS root folder
net use r: \\twhtshr04\users
:: Create the User's Folder
mkdir r:\%2.%1
:: Set Share Permissions on the User’s Folder
rmtshare \\twhtshr04\%1$=D:\users\%2.%1 /g %1:f
:: Set NTFS Permissions on the User’s Folder
xcacls.vbs r:\%2.%1 /g “HCA\%1:f” /I copy /Q
:: Close the Mapped Drive to the USERS root folder
net use r: /delete
pause
:end