Skip to content

Commit

Permalink
added original apply script
Browse files Browse the repository at this point in the history
  • Loading branch information
darksidemilk committed Jun 2, 2016
1 parent 59a4c39 commit 060a51c
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 7 deletions.
8 changes: 4 additions & 4 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Auto detect text files and perform LF normalization
* text=crlf
*.bat eol=crlf
*.log eol=crlf
*.bat eol=crl
f*.log eol=crlf
*.xml eol=crlf
*.ps1 eol=crlf
*.tmpl eol=crlf
Expand All @@ -17,8 +17,8 @@
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOCX diff=astextplai
n*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
Expand Down
92 changes: 92 additions & 0 deletions Apply-Default-Profile.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
::-----------------------------------------------------------------------------
:: Script Name: Apply-Default-Profile
:: Original Author: jfullmer
:: Created Date: 2016-02-18 16:39:27
:: Last Updated Date: 2016-06-02 14:51:01
:: Update Author: jfullmer
:: Version: 2.8
::-----------------------------------------------------------------------------

@ECHO OFF
REM @ECHO off to not output the commands being run to the console
REM Requires args passed of department
rem if department is Touchscreen autologon is enabled and fog will reboot after applying the profile

set dept=%1
set domain="domain for network login to share with network path (put localhost for local login) ?: "
set username="Username for network share?: "
set passwd="Password for network share?: "
call :OSversion

call :main
exit

:main
REM main Function that just calls the other Functions

call :funcHead "Welcome to the Windows 10 Default Profile Copy Script!"
call :setVars
call :CopyFromNetwork
call :funcHead "Done creating custom default profile! & echo.Goodbye"
EXIT /B

:setVars
REM Function to set script variables

REM c stands for Custom, d stands for default. cUser should be the name of the user you Customized
REM These variables just point to the user folders and the local and roaming appdata folders that
REM store all the settings for a user profile

call :funcHead "Setting directory variables..."

set cUser=adl
set custom=C:\Users\%cUser%
set default=C:\Users\Default
set cLocal=C:\Users\%cUser%\AppData\Local
set dLocal=C:\Users\Default\AppData\Local
set cRoam=C:\Users\%cUser%\AppData\Roaming
set dRoam=C:\Users\Default\AppData\Roaming
set share=\\path\to\DefaultProfiles\%winVer%\%dept%
net use %share% /USER:%domain%\%username% %password%

call :dots
EXIT /B

:OSversion
:: Function to get current OS version
echo. Getting OS...
FOR /F "tokens=4-5 delims=. " %%i in ('ver') do set os=%%i.%%j
if "%os%" == "5.1" set winVer=WinXP
if "%os%" == "5.2" set winVer=WinXP
if "%os%" == "6.1" set winVer=Win7
if "%os%" == "6.2" set winVer=Win8
if "%os%" == "6.3" set winVer=Win8.1
if "%os%" == "10.0" set winVer=Win10

EXIT /B

:CopyFromNetwork
REM This copies the newly created profile to the network share

call :funcHead "Copying profile From network!"
echo. Delete and recreate default profile folder so there aren't remnants of other profiles...
rmdir %default% /S /Q
mkdir %default%
ROBOCOPY %share%\Default %default% /S /MIR /R:1 /W:1 /MT:128 /ZB /LOG:C:\defaultProfileApplied-%dept%.log
XCOPY %share%\Default\ntuser* %default%\ /H /Y > C:\defaultProfile-ntuser-%dept%.log

net use %share% /delete

EXIT /B

:dots
REM just echoing dots in a Function instead of copy pasting them so that it's consistent
echo ......................................................................
EXIT /B

:funcHead
REM A simple function for displaying a consistent header at the start of functions
call :dots
echo. %~1
call :dots
EXIT /B
6 changes: 3 additions & 3 deletions Create-Deployable-Default-Profile.bat
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
:: Script Name: Create-Deployable-Default-Profile
:: Original Author: jfullmer
:: Created Date: 2016-02-18 16:39:23
:: Last Updated Date: 2016-04-12 17:09:35
:: Last Updated Date: 2016-06-02 14:50:07
:: Update Author: jfullmer
:: Version: 3.8
::-----------------------------------------------------------------------------
Expand Down Expand Up @@ -36,7 +36,7 @@ del C:\Create-Deployable-Default-Profile.bat & exit
:copySelf
IF NOT %pwd%==C:\ (
echo. Copying self to C drive
net use \\arrowfs3\scripts /USER:%domain%\%username% %password%
net use \\script\share /USER:%domain%\%username% %password%
XCOPY %networkPathToScript% C:\ /H /Y
net session >nul 2>&1
if %errorLevel% == 0 (
Expand Down Expand Up @@ -71,7 +71,7 @@ del C:\Create-Deployable-Default-Profile.bat & exit
set dLocal=C:\Users\Default\AppData\Local
set cRoam=C:\Users\%cUser%\AppData\Roaming
set dRoam=C:\Users\Default\AppData\Roaming
set profiles=\\arrowfs1\IT\DefaultProfiles
set profiles=\\path\toshare\DefaultProfiles
net use %profiles% /USER:%domain%\%username% %password%
call :OSversion
call :setDept
Expand Down

0 comments on commit 060a51c

Please sign in to comment.