Hello,
I'm trying to make a batch file that will allow me to fill in a field with a user name for a roaming profile ownership command. Having to retype this command over and over again is tedious. So I created the following code below; but I'm clueless as to how to change this one field within the command in this batch file for each user.
here is the command: psexec -s "icacls" "d:\profiles\username.DOMAIN.V2" /grant administrators:F /t
the name is bold is the field i'd like to change on each execution of this batch program so I can breeze thru all 550 of these roaming profile recreations since we have a corrupt print driver that fucked all of the profiles on 6 TS servers including the roaming profile which is now corrupt on all of them. Takes about 25 minutes per user and 550 users ya do the math, lol!!!!
here is my code so far, any help would be appreciated.
@echo off
color 0A
title Corrupt Roaming Profile Change.
:start
echo Welcome, %USERNAME%
echo What would you like to do?
echo.
echo 1. Click here for a Nude photo!
echo 2. Take Ownership of User's Roaming Profile
echo.
echo 0. Quit
echo.
set /p choice="Enter your choice: "
if "%choice%"=="1" goto pervert
if "%choice%"=="2" goto ownership-change
echo.
if "%choice%"=="0" exit
echo Invalid choice: %choice%
echo.
pause
cls
goto start
:pervert
cls
echo your a pervert, you know it, you clicked on this option shame on you!!!
echo.
goto cancel-special
:ownership-change
echo.
echo.
psexec -s "icacls" "d:\profiles\nocasio.DOMAIN.V2" /grant administrators:F /t
echo roaming profile forced ownership change in progress...
echo.
:cancel-special
set /p cancel="Type cancel to stop action: "
if not "%cancel%"=="cancel" exit
cls
echo Action is cancelled.
echo.
pause
exit