• Recent
    • Unsolved
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Cortana/Windows Search breaks in default profile

    Scheduled Pinned Locked Moved
    Windows Problems
    cortana search default profile windows 10
    9
    81
    73.2k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • JJ FullmerJ
      JJ Fullmer Testers @Wayne Workman
      last edited by

      @Wayne-Workman I have since updated this script.
      I don’t have a way to dynamically update all users. It essentially copies the neccesarry app data folders that won’t break cortana/start
      to the default profile and then copies that default profile to a network share for deploying via a fog snapin with another script that takes arguements of the name of the profile you make.

      Here let me just take out my credentials and share name and post a copies of my current create and apply windows 10 profile scripts…

      p.s. I recently discovered that profiles made on 64 bit windows won’t work on 32 bit windows. So you have to create separate versions from 32 bit and 64 bit windows installs if you have different archs in your environment.

      Have you tried the FogApi powershell module? It's pretty cool IMHO
      https://github.com/darksidemilk/FogApi
      https://fogapi.readthedocs.io/en/latest/
      https://www.powershellgallery.com/packages/FogApi
      https://forums.fogproject.org/topic/12026/powershell-api-module

      Wayne WorkmanW 1 Reply Last reply Reply Quote 1
      • Wayne WorkmanW
        Wayne Workman @JJ Fullmer
        last edited by

        @Arrowhead-IT Much appreciated!

        Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!
        Daily Clean Installation Results:
        https://fogtesting.fogproject.us/
        FOG Reporting:
        https://fog-external-reporting-results.fogproject.us/

        1 Reply Last reply Reply Quote 0
        • JJ FullmerJ
          JJ Fullmer Testers @Wayne Workman
          last edited by JJ Fullmer

          @Wayne-Workman

          some quick notes. You do need to put your username and password in plain text for shares, unless you have shares that give everyone access. If anyone knows of a way to encrypt that, I’d love to hear it. I know it can be done with openssl in linux bash scripts but I am yet to find the equivalent for a batch script. But hey bash will come to windows 10 soon.

          This script hasn’t been tested for windows 7 or 8 profiles. It does detect the windows version because I was preparing to add that kind of functionality but since I am ending up moving completely to windows 10, I never put the work into it

          The create profile script prompts you for the name of the user profile you customized and asks you for what department/profile you are making it for.

          The Apply simply takes one arguement of the profile name. So you can upload just the one script to fog and make a bunch of snapins with different args for each profile you have to deploy.

          Also note that I have some extra app data folders for custom settings of specific programs we use. I left them in there as examples.

          Bath script to create Deployable Default Profile

          ::-----------------------------------------------------------------------------
          :: 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
          :: Update Author: jfullmer
          :: Version: 3.8
          ::-----------------------------------------------------------------------------
          
          @ECHO OFF
          	REM @ECHO off to not output the commands being run to the console
          	REM This script copies a Customized windows 10 profile to the default profile so that
          	REM all new profiles are created with the same settings
          
          SET pwd=%~dp0
          call :main
          del C:\Create-Deployable-Default-Profile.bat & exit
          
          :main
          	REM main Function that just calls the other Functions
          
          	call :copySelf
          	call :funcHead "Welcome to the Windows Default Profile Creator Script!"
          	call :setVars
          	call :funcHead "Copying Customized Profile From %custom% to %default% ..."
          	call :AppData
          	call :CustomSettings
          	call :CopyToNetwork
          	call :funcHead "Done creating custom default profile! & echo.Goodbye"	
          	EXIT /B
          
          :copySelf
          	rem In some instances running this from a share doesn't work, so copy itself and start the copied version to run local
          	IF NOT %pwd%==C:\ (
          		echo. Copying self to C drive
          		net use \\path\to\share /USER:domain\user password	
          		XCOPY \\path\to\share\Create-Deployable-Default-Profile.bat C:\ /H /Y
          	 	rem Make sure it's being run as an admin
          	 	net session >nul 2>&1
          	    if %errorLevel% == 0 (
          			echo opening copied version.
          			start C:\Create-Deployable-Default-Profile.bat
          			exit
          	    ) else (
          	        echo This needs to be run as admin, try again please.
          	    	@pause
          	    	exit
          		)
              )
          	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..."
          	
          	rem set cUser=adl
          	echo. Don't run this script from the user you're copying!
          	set /p cUser="What is the username of the profile you customized? -> "
          	set custom=C:\Users\%cUser%
          	set default=C:\Users\Default
          	set cPF=C:\Users\%cUser%\AppData\ProgramFiles
          	set dPF=C:\Users\Default\AppData\ProgramFiles
          	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
          	rem The script will create windows version and department folders
          	set profiles=\\path\to\share\with\profiles
          	net use %profiles% /USER:domain\user password
          	call :OSversion
          	call :setDept
          		
          	call :dots
          	EXIT /B
          
          :setDept
          	rem Function to set department via prompt. 
          	echo. What department/group is this profile for? (no spaces)
          	echo. The Current Choices are... (A different entry will create a new folder)
          	rem list profiles
          	dir /b %profiles%\%winVer%
          	set /P dept="Enter The Dept Here -> "
          	set share=%profiles%\%winVer%\%dept%
          	if NOT EXIST %share% mkdir %share%
          	if NOT EXIST %share%\logs mkdir %share%\logs
          	set logs=%share%\logs
          	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
          
          :copyDir
          	REM Function inputs - 1 = display of what is copying 2 = source folder 3 = destination folder 
          	
          	REM This Function simply displays what you're copying and copies it. Did a Function to have less
          	REM copy paste of command line options and have cleaner code.
          	REM Note that when calling the Function all passed parameters should be encased in double quotes
          	REM otherwise ROBOCOPY won't read the directories as seperate
          	
          	REM ROBOCOPY or robust copy, is a tool for copying directories or files in windows command line
          	REM The syntax is ROBOCOPY sourceFolder DestFolder options
          	REM the options used make it so a mirrored version of the source and its subdirectories are copied
          	REM to the destination with 64 threads (64 files at once) overwriting existin files retrying any failed files 
          	REM only once after 1 second of waiting and all without any verbose output
          	
          	REM /S - subdirectories /MIR - mirror /MT:64 - multithreaded copy with 64 threads, i.e. 64 files at a time instead of 1. 
          	REM /LOG - output to logfile instead of console, ROBOCOPY /? says this provides better performance in multithreaded mode
          	REM /IS - include same files i.e. overwrite existing /R:1 retry on error once (default is 1 million) 
          	REM W:1 - wait one second between retry on error (default is 30 seconds) 
          	REM the /N* are all to decrease output for automation. Since they go to a log file you can take them out if you want ( I did take them out)
          	REM /NP - no progress /NS - don't log file sizes /NC - don't log file classes /NFL - don't log file names /NDL - don't log directory names
          	REM /NJH - no job header /NJS - no job summary
          
          	echo. Copying %~1...
          	ROBOCOPY "%~2" "%~3" /S /MIR /MT:128 /LOG:"%logs%\%~1.log" /IS /R:1 /W:1 /ZB
          	echo. Done Copying %~1
          	EXIT /B
          
          :AppData
          	REM Function to copy all Customizations settings that are stored in files in the AppData folder
          	
          	call :funcHead "Copying Customizations From AppData..."
          	
          	REM directories used in all versions of windows
          	call :copyDir "Desktop" "%custom%\Desktop" "%default%\Desktop"	
          	call :copyDir "Firefox Customizations" "%cRoam%\Mozilla" "%dRoam%\Mozilla"
          	call :copyDir "Google Chrome Customizations" "%cLocal%\Google" "%dLocal%\Google"
          	call :copyDir "Task Bar Pin Shortcuts" "%cRoam%\Microsoft\Internet Explorer" "%dRoam%\Microsoft\Internet Explorer"
          	call :copyDir "Saleslogix" "%cRoam%\Saleslogix" "%dRoam%\Saleslogix"
          	call :copyDir "Sage Software" "%cRoam%\Sage Software" "%dRoam%\Sage Software"
          	call :copyDir "Saleslogix" "%cLocal%\Saleslogix" "%dLocal%\Saleslogix"
          	call :copyDir "Sage Software" "%cLocal%\Sage Software" "%dLocal%\Sage Software"
          	rem IF %dept%==IT (
          	rem 	call :copyDir "Terminals" "%cLocal%\Robert_Chartier" "%dLocal%\Robert_Chartier"
          	rem 	call :copyDir "VMware Vsphere" "%cLocal%\VMware" "%dLocal%\VMware"
          	rem 	call :copyDir "VMware Vsphere" "%cRoam%\VMware" "%dRoam%\VMware"
          	rem 	call :copyDir "Camtasia" "%cRoam%\TechSmith" "%dRoam%\TechSmith"
          	rem 	call :copyDir "Camtasia" "%cLocal%\TechSmith" "%dLocal%\TechSmith"
          	rem 	call :copyDir "slack" "%cLocal%\slack" "%dLocal%\slack"
          	rem 	call :copyDir "ProgramFiles" %cPF% %dPF%
          	rem )
          	call :copyDir "VLC settings" "%cRoam%\vlc" "%dRoam%\vlc"
          	call :copyDir "FaxFinder settings" "%cRoam%\FaxFinder Client Software" "%dRoam%\FaxFinder Client Software"
          	
          	REM The remaining dirs are specific to Windows 10 
          	REM Note: A starup script will be required on first login to copy the favorites for Microsoft edge to the Packages directory in the newly created User
          	REM That logon script would only need to be one line like so...
          	REM ROBOCOPY "%localAppData%\MicrosoftEdge\User" "%localAppData%\Packages\Microsoft.MicrosoftEdge_8wekyb3d8bbwe\AC\MicrosoftEdge\User" /S /MIR /MT:64 /LOG:C:\logs\edgeBookmarks.txt /IS /R:1 /W:1 
          	
          	rem call :copyDir "Microsoft Edge Customizations" "%cLocal%\Packages\Microsoft.MicrosoftEdge_8wekyb3d8bbwe\AC\MicrosoftEdge\User" "%dLocal%\MicrosoftEdge\User"
          	call :copyDir "Start Menu Tiles Part 1 of 3" "%cLocal%\TileDataLayer" "%dLocal%\TileDataLayer"
          	call :copyDir "Start Menu Tiles Part 2 of 3" "%cRoam%\Microsoft\Windows\Start Menu" "%dRoam%\Microsoft\Windows\Start Menu"
          	call :copyDir "Start Menu Tiles Part 3 of 3" "%cLocal%\Microsoft\Windows\Shell" "%dLocal%\Microsoft\Windows\Shell"
          	
          	echo. Done Copying AppData Folders...
          	call :dots
          	EXIT /B
          
          :CustomSettings
          	REM This Function copies the ntuser.dat and related system files that store things like task bar pin order, 
          	REM mapped network drives, taskbar toolbars, explorer settings, desktop background settings, etc.
          	REM It uses xcopy to copy all files that start with ntuser via * wildcard and uses the options...
          	REM \H - copy hidden system files /Y - overwrite existsing files without prompt 
          
          	call :funcHead "Copying custom settings (i.e. task bar pins and toolbars, desktop background, etc.) from ntuser .dat system files..."
          	
          	XCOPY %custom%\ntuser* %default%\ /H /Y > %logs%\ntuserFiles.log
          
          	echo. Done Copying Custom Settings
          	call :dots
          	EXIT /B
          
          :CopyToNetwork
          	REM This copies the newly created profile to the network share
          
          	call :funcHead "Copying profile to network!"
          
          	ROBOCOPY %default% %share%\Default /S /MIR /R:1 /W:1 /MT:128 /ZB /XJ
          	XCOPY %default%\ntuser* %share%\Default\ /H /Y > %logs%\ntuserFilesRemote.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
          

          Batch script/snapin to Apply Default Profile

          ::-----------------------------------------------------------------------------
          :: Script Name: Apply-Default-Profile-args
          :: Original Author: jfullmer
          :: Created Date: 2016-02-18 16:39:27
          :: Last Updated Date: 2016-05-11 16:29:08
          :: Update Author: jfullmer
          :: Version: 2.7
          ::-----------------------------------------------------------------------------
          
          @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
          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\share\%winVer%\%dept%
          	net use %share% /USER:domain\user 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
          

          Have you tried the FogApi powershell module? It's pretty cool IMHO
          https://github.com/darksidemilk/FogApi
          https://fogapi.readthedocs.io/en/latest/
          https://www.powershellgallery.com/packages/FogApi
          https://forums.fogproject.org/topic/12026/powershell-api-module

          Wayne WorkmanW Tom ElliottT 2 Replies Last reply Reply Quote 2
          • Wayne WorkmanW
            Wayne Workman @JJ Fullmer
            last edited by

            @Arrowhead-IT That is a sick setup, good job man! I’m not as skilled with batch scripting as you are, clearly.

            I’ll be using this tomorrow.

            Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!
            Daily Clean Installation Results:
            https://fogtesting.fogproject.us/
            FOG Reporting:
            https://fog-external-reporting-results.fogproject.us/

            1 Reply Last reply Reply Quote 0
            • x23piracyX
              x23piracy
              last edited by x23piracy

              Hi,

              i don’t use that tricky registry tweaks for making a profile to default.
              Ever tried STRG + SHIFT + F3 in Express Settings to enter Audit mode?
              Then do your changes and fire a sysprep:

              sysprep /oobe /generalize /shutdown /unattend:c:\pathtoanswerfile\unattend.xml
              Make sure your unattend.xml has the copyprofile option enabled!!!
              Now take your image.

              If you ever need to make changes restore to vm again let it boot and goto audit mode again: sysprep /audit /reboot

              I have that parts scripted for my self and can give you that stuff if you need.

              Never try to uninstall staged appx apps or you break sysprep, also don’t use O&O Shutup or Stuff like that this also breaks sysprep.

              Regards X23

              ║▌║█║▌│║▌║▌█

              JJ FullmerJ 1 Reply Last reply Reply Quote 1
              • JJ FullmerJ
                JJ Fullmer Testers @x23piracy
                last edited by

                @x23piracy Yes I am aware of the copy profile option and that is a great method for a default profile if you only need one default profile for the image.

                The end result of solving this problem was a snapin that deploys a profile to any existing windows 10 computer so that all profiles created after the profile is deployed use the customized default profile. So you can have one base image that can have any number of custom profiles added to it.
                It doesn’t require the registry tweaks or anything like that. Just plain and simple copies the files that contain the settings that will create your customized profile when a new profile is created.

                So you could use this method to have one image with all your programs installed and use profiles to give access to only the programs needed to different departments.

                Or you could document what programs have shortcuts in each profile for each department and use fog groups to deploy the programs needed and then the profile provisioning style.

                I’m sure there are other methods to do this. For example there are some group policies that can be used. This is just my solution to the problem of customizing local profiles without breaking the profiles and while still allowing users to customize the profiles themselves.

                Have you tried the FogApi powershell module? It's pretty cool IMHO
                https://github.com/darksidemilk/FogApi
                https://fogapi.readthedocs.io/en/latest/
                https://www.powershellgallery.com/packages/FogApi
                https://forums.fogproject.org/topic/12026/powershell-api-module

                Wayne WorkmanW 1 Reply Last reply Reply Quote 0
                • Wayne WorkmanW
                  Wayne Workman @JJ Fullmer
                  last edited by

                  @Arrowhead-IT I’ve been trying to use the scripts you posted - lots of things going wrong.

                  I sorted a permissions issue on the intended share first, but I’m still getting a lot of access denied errors… Suppose I need to dig deeper, run the script as elevated.

                  My intention is to re-write this thing to be more simple. It’s highly complex I feel, and really overkill.

                  Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!
                  Daily Clean Installation Results:
                  https://fogtesting.fogproject.us/
                  FOG Reporting:
                  https://fog-external-reporting-results.fogproject.us/

                  JJ FullmerJ 1 Reply Last reply Reply Quote 0
                  • JJ FullmerJ
                    JJ Fullmer Testers @Wayne Workman
                    last edited by

                    @Wayne-Workman I do have a tendency to do that, complicating things and adding some overkill. You do need to run it as elevated because I think doing anything to the hidden C:\Users\Default folder requires elevation.

                    The access denied errors are usually solved by copying the script to the C drive to run locally, which is why it copies itself to the C drive to run locally. Windows command prompt and network unc paths don’t always get along. The copySelf function was my solution.

                    Have you tried the FogApi powershell module? It's pretty cool IMHO
                    https://github.com/darksidemilk/FogApi
                    https://fogapi.readthedocs.io/en/latest/
                    https://www.powershellgallery.com/packages/FogApi
                    https://forums.fogproject.org/topic/12026/powershell-api-module

                    Wayne WorkmanW 1 Reply Last reply Reply Quote 0
                    • Wayne WorkmanW
                      Wayne Workman @JJ Fullmer
                      last edited by

                      @Arrowhead-IT Got this working, Now I understand the beauty of these two scripts design.

                      Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!
                      Daily Clean Installation Results:
                      https://fogtesting.fogproject.us/
                      FOG Reporting:
                      https://fog-external-reporting-results.fogproject.us/

                      JJ FullmerJ 1 Reply Last reply Reply Quote 0
                      • Tom ElliottT
                        Tom Elliott @JJ Fullmer
                        last edited by Wayne Workman

                        @Arrowhead-IT said in Cortana/Windows Search breaks in default profile:

                        @Wayne-Workman

                        some quick notes. You do need to put your username and password in plain text for shares, unless you have shares that give everyone access. If anyone knows of a way to encrypt that, I’d love to hear it. I know it can be done with openssl in linux bash scripts but I am yet to find the equivalent for a batch script. But hey bash will come to windows 10 soon.

                        This script hasn’t been tested for windows 7 or 8 profiles. It does detect the windows version because I was preparing to add that kind of functionality but since I am ending up moving completely to windows 10, I never put the work into it

                        The create profile script prompts you for the name of the user profile you customized and asks you for what department/profile you are making it for.

                        The Apply simply takes one arguement of the profile name. So you can upload just the one script to fog and make a bunch of snapins with different args for each profile you have to deploy.

                        Also note that I have some extra app data folders for custom settings of specific programs we use. I left them in there as examples.

                        Bath script to create Deployable Default Profile

                        ::-----------------------------------------------------------------------------
                        :: 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
                        :: Update Author: jfullmer
                        :: Version: 3.8
                        ::-----------------------------------------------------------------------------
                        
                        @ECHO OFF
                        	REM @ECHO off to not output the commands being run to the console
                        	REM This script copies a Customized windows 10 profile to the default profile so that
                        	REM all new profiles are created with the same settings
                        
                        SET pwd=%~dp0
                        call :main
                        del C:\Create-Deployable-Default-Profile.bat & exit
                        
                        :main
                        	REM main Function that just calls the other Functions
                        
                        	call :copySelf
                        	call :funcHead "Welcome to the Windows Default Profile Creator Script!"
                        	call :setVars
                        	call :funcHead "Copying Customized Profile From %custom% to %default% ..."
                        	call :AppData
                        	call :CustomSettings
                        	call :CopyToNetwork
                        	call :funcHead "Done creating custom default profile! & echo.Goodbye"	
                        	EXIT /B
                        
                        :copySelf
                        	rem In some instances running this from a share doesn't work, so copy itself and start the copied version to run local
                        	IF NOT %pwd%==C:\ (
                        		echo. Copying self to C drive
                        		net use \\path\to\share /USER:domain\user password	
                        		XCOPY \\path\to\share\Create-Deployable-Default-Profile.bat C:\ /H /Y
                        	 	rem Make sure it's being run as an admin
                        	 	net session >nul 2>&1
                        	    if %errorLevel% == 0 (
                        			echo opening copied version.
                        			start C:\Create-Deployable-Default-Profile.bat
                        			exit
                        	    ) else (
                        	        echo This needs to be run as admin, try again please.
                        	    	@pause
                        	    	exit
                        		)
                            )
                        	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..."
                        	
                        	rem set cUser=adl
                        	echo. Don't run this script from the user you're copying!
                        	set /p cUser="What is the username of the profile you customized? -> "
                        	set custom=C:\Users\%cUser%
                        	set default=C:\Users\Default
                        	set cPF=C:\Users\%cUser%\AppData\ProgramFiles
                        	set dPF=C:\Users\Default\AppData\ProgramFiles
                        	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
                        	rem The script will create windows version and department folders
                        	set profiles=\\path\to\share\with\profiles
                        	net use %profiles% /USER:domain\user password
                        	call :OSversion
                        	call :setDept
                        		
                        	call :dots
                        	EXIT /B
                        
                        :setDept
                        	rem Function to set department via prompt. 
                        	echo. What department/group is this profile for? (no spaces)
                        	echo. The Current Choices are... (A different entry will create a new folder)
                        	rem list profiles
                        	dir /b %profiles%\%winVer%
                        	set /P dept="Enter The Dept Here -> "
                        	set share=%profiles%\%winVer%\%dept%
                        	if NOT EXIST %share% mkdir %share%
                        	if NOT EXIST %share%\logs mkdir %share%\logs
                        	set logs=%share%\logs
                        	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
                        
                        :copyDir
                        	REM Function inputs - 1 = display of what is copying 2 = source folder 3 = destination folder 
                        	
                        	REM This Function simply displays what you're copying and copies it. Did a Function to have less
                        	REM copy paste of command line options and have cleaner code.
                        	REM Note that when calling the Function all passed parameters should be encased in double quotes
                        	REM otherwise ROBOCOPY won't read the directories as seperate
                        	
                        	REM ROBOCOPY or robust copy, is a tool for copying directories or files in windows command line
                        	REM The syntax is ROBOCOPY sourceFolder DestFolder options
                        	REM the options used make it so a mirrored version of the source and its subdirectories are copied
                        	REM to the destination with 64 threads (64 files at once) overwriting existin files retrying any failed files 
                        	REM only once after 1 second of waiting and all without any verbose output
                        	
                        	REM /S - subdirectories /MIR - mirror /MT:64 - multithreaded copy with 64 threads, i.e. 64 files at a time instead of 1. 
                        	REM /LOG - output to logfile instead of console, ROBOCOPY /? says this provides better performance in multithreaded mode
                        	REM /IS - include same files i.e. overwrite existing /R:1 retry on error once (default is 1 million) 
                        	REM W:1 - wait one second between retry on error (default is 30 seconds) 
                        	REM the /N* are all to decrease output for automation. Since they go to a log file you can take them out if you want ( I did take them out)
                        	REM /NP - no progress /NS - don't log file sizes /NC - don't log file classes /NFL - don't log file names /NDL - don't log directory names
                        	REM /NJH - no job header /NJS - no job summary
                        
                        	echo. Copying %~1...
                        	ROBOCOPY "%~2" "%~3" /S /MIR /MT:128 /LOG:"%logs%\%~1.log" /IS /R:1 /W:1 /ZB
                        	echo. Done Copying %~1
                        	EXIT /B
                        
                        :AppData
                        	REM Function to copy all Customizations settings that are stored in files in the AppData folder
                        	
                        	call :funcHead "Copying Customizations From AppData..."
                        	
                        	REM directories used in all versions of windows
                        	call :copyDir "Desktop" "%custom%\Desktop" "%default%\Desktop"	
                        	call :copyDir "Firefox Customizations" "%cRoam%\Mozilla" "%dRoam%\Mozilla"
                        	call :copyDir "Google Chrome Customizations" "%cLocal%\Google" "%dLocal%\Google"
                        	call :copyDir "Task Bar Pin Shortcuts" "%cRoam%\Microsoft\Internet Explorer" "%dRoam%\Microsoft\Internet Explorer"
                        	call :copyDir "Saleslogix" "%cRoam%\Saleslogix" "%dRoam%\Saleslogix"
                        	call :copyDir "Sage Software" "%cRoam%\Sage Software" "%dRoam%\Sage Software"
                        	call :copyDir "Saleslogix" "%cLocal%\Saleslogix" "%dLocal%\Saleslogix"
                        	call :copyDir "Sage Software" "%cLocal%\Sage Software" "%dLocal%\Sage Software"
                        	rem IF %dept%==IT (
                        	rem 	call :copyDir "Terminals" "%cLocal%\Robert_Chartier" "%dLocal%\Robert_Chartier"
                        	rem 	call :copyDir "VMware Vsphere" "%cLocal%\VMware" "%dLocal%\VMware"
                        	rem 	call :copyDir "VMware Vsphere" "%cRoam%\VMware" "%dRoam%\VMware"
                        	rem 	call :copyDir "Camtasia" "%cRoam%\TechSmith" "%dRoam%\TechSmith"
                        	rem 	call :copyDir "Camtasia" "%cLocal%\TechSmith" "%dLocal%\TechSmith"
                        	rem 	call :copyDir "slack" "%cLocal%\slack" "%dLocal%\slack"
                        	rem 	call :copyDir "ProgramFiles" %cPF% %dPF%
                        	rem )
                        	call :copyDir "VLC settings" "%cRoam%\vlc" "%dRoam%\vlc"
                        	call :copyDir "FaxFinder settings" "%cRoam%\FaxFinder Client Software" "%dRoam%\FaxFinder Client Software"
                        	
                        	REM The remaining dirs are specific to Windows 10 
                        	REM Note: A starup script will be required on first login to copy the favorites for Microsoft edge to the Packages directory in the newly created User
                        	REM That logon script would only need to be one line like so...
                        	REM ROBOCOPY "%localAppData%\MicrosoftEdge\User" "%localAppData%\Packages\Microsoft.MicrosoftEdge_8wekyb3d8bbwe\AC\MicrosoftEdge\User" /S /MIR /MT:64 /LOG:C:\logs\edgeBookmarks.txt /IS /R:1 /W:1 
                        	
                        	rem call :copyDir "Microsoft Edge Customizations" "%cLocal%\Packages\Microsoft.MicrosoftEdge_8wekyb3d8bbwe\AC\MicrosoftEdge\User" "%dLocal%\MicrosoftEdge\User"
                        	call :copyDir "Start Menu Tiles Part 1 of 3" "%cLocal%\TileDataLayer" "%dLocal%\TileDataLayer"
                        	call :copyDir "Start Menu Tiles Part 2 of 3" "%cRoam%\Microsoft\Windows\Start Menu" "%dRoam%\Microsoft\Windows\Start Menu"
                        	call :copyDir "Start Menu Tiles Part 3 of 3" "%cLocal%\Microsoft\Windows\Shell" "%dLocal%\Microsoft\Windows\Shell"
                        	
                        	echo. Done Copying AppData Folders...
                        	call :dots
                        	EXIT /B
                        
                        :CustomSettings
                        	REM This Function copies the ntuser.dat and related system files that store things like task bar pin order, 
                        	REM mapped network drives, taskbar toolbars, explorer settings, desktop background settings, etc.
                        	REM It uses xcopy to copy all files that start with ntuser via * wildcard and uses the options...
                        	REM \H - copy hidden system files /Y - overwrite existsing files without prompt 
                        
                        	call :funcHead "Copying custom settings (i.e. task bar pins and toolbars, desktop background, etc.) from ntuser .dat system files..."
                        	
                        	XCOPY %custom%\ntuser* %default%\ /H /Y > %logs%\ntuserFiles.log
                        
                        	echo. Done Copying Custom Settings
                        	call :dots
                        	EXIT /B
                        
                        :CopyToNetwork
                        	REM This copies the newly created profile to the network share
                        
                        	call :funcHead "Copying profile to network!"
                        
                        	ROBOCOPY %default% %share%\Default /S /MIR /R:1 /W:1 /MT:128 /ZB /XJ
                        	XCOPY %default%\ntuser* %share%\Default\ /H /Y > %logs%\ntuserFilesRemote.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
                        

                        Batch script/snapin to Apply Default Profile

                        ::-----------------------------------------------------------------------------
                        :: Script Name: Apply-Default-Profile-args
                        :: Original Author: jfullmer
                        :: Created Date: 2016-02-18 16:39:27
                        :: Last Updated Date: 2016-05-11 16:29:08
                        :: Update Author: jfullmer
                        :: Version: 2.7
                        ::-----------------------------------------------------------------------------
                        
                        @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
                        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\share\%winVer%\%dept%
                        	net use %share% /USER:domain\user 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
                        

                        Imma say #wiki -worth?

                        Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

                        Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

                        Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

                        1 Reply Last reply Reply Quote 2
                        • JJ FullmerJ
                          JJ Fullmer Testers @Wayne Workman
                          last edited by

                          @Wayne-Workman What if anything did you have to change?

                          Have you tried the FogApi powershell module? It's pretty cool IMHO
                          https://github.com/darksidemilk/FogApi
                          https://fogapi.readthedocs.io/en/latest/
                          https://www.powershellgallery.com/packages/FogApi
                          https://forums.fogproject.org/topic/12026/powershell-api-module

                          Wayne WorkmanW 2 Replies Last reply Reply Quote 0
                          • Wayne WorkmanW
                            Wayne Workman @JJ Fullmer
                            last edited by

                            @Arrowhead-IT I removed the copy self line so that doesn’t run, as I’m just running the script from the c:\ drive.

                            I want all users to use the same profile defaults, so I don’t need more than one.

                            I named the group “default” when prompted, and then in the deployment script I just hard coded “default” where it normally grabs the group arguments.

                            Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!
                            Daily Clean Installation Results:
                            https://fogtesting.fogproject.us/
                            FOG Reporting:
                            https://fog-external-reporting-results.fogproject.us/

                            1 Reply Last reply Reply Quote 1
                            • Wayne WorkmanW
                              Wayne Workman @JJ Fullmer
                              last edited by

                              @Arrowhead-IT So - I can copy the profile I’ve set up to a share, and can use a snapin to copy it back down.

                              it appears to copy correctly, because I can see the size change in c:\Users\default

                              However, start menu tile settings are clearly not applying - also I’m still getting the nasty “We’re glad you’re here” stuff upon a user’s first login.

                              Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!
                              Daily Clean Installation Results:
                              https://fogtesting.fogproject.us/
                              FOG Reporting:
                              https://fog-external-reporting-results.fogproject.us/

                              JJ FullmerJ 1 Reply Last reply Reply Quote 0
                              • Wayne WorkmanW
                                Wayne Workman
                                last edited by

                                Ok, update.

                                For whatever reason, the profile didn’t apply for one account, but trying another and it DID apply!

                                Weird…

                                Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!
                                Daily Clean Installation Results:
                                https://fogtesting.fogproject.us/
                                FOG Reporting:
                                https://fog-external-reporting-results.fogproject.us/

                                1 Reply Last reply Reply Quote 1
                                • JJ FullmerJ
                                  JJ Fullmer Testers @Wayne Workman
                                  last edited by

                                  @Wayne-Workman Hmmm, I haven’t had that login screen popup, there are some group policies in Computer Config → Admin Templates → System → Logon to implicitly stop the sign-in animation/getting started welcome screen. I don’t have them configured.

                                  Did the profile that didn’t get created perhaps already have a user folder? i.e the user name was Wayne and it was used to create the profile in the image and its folder still existed in C:\users\Wayne? If the folder already exists it can cause issues. My local files restore script gets around that by waiting for the user profile to be created. The user folder already existing and the computer having just gone through sysprep is the only way I can think of that would make it not work right. And even then, it would usually just create a new one with a user folder named name.domain or something of that sort.

                                  Every once in a while I do see some start menu tiles issues. It’s intermittent and I haven’t narrowed it down. All the tiles will be there but the icons are missing. If you resize any tile the icon comes back. I usually just recreate the profile via the script if I find that is happening with a specific profile and it fixes the issue for future deployment. One tile that loves to give trouble randomly is chrome. Stupid chrome. The resize trick doesn’t always work on it and it has to be unpinned and repinned. It doesn’t always happen though, I think it has something to do with chrome’s auto updating to new versions or something.

                                  So it isn’t a 100% flawless system. But resizing a couple start screen icons is a lot less time then customizing an entire profile every time. And probably 99% of the time it just plain works for me. Just the occasional start menu pin icon disappears.

                                  Have you tried the FogApi powershell module? It's pretty cool IMHO
                                  https://github.com/darksidemilk/FogApi
                                  https://fogapi.readthedocs.io/en/latest/
                                  https://www.powershellgallery.com/packages/FogApi
                                  https://forums.fogproject.org/topic/12026/powershell-api-module

                                  Wayne WorkmanW 1 Reply Last reply Reply Quote 0
                                  • Wayne WorkmanW
                                    Wayne Workman @JJ Fullmer
                                    last edited by

                                    @Arrowhead-IT said in Cortana/Windows Search breaks in default profile:

                                    Did the profile that didn’t get created perhaps already have a user folder?

                                    Totally possible.

                                    there are some group policies in Computer Config → Admin Templates → System → Logon to implicitly stop the sign-in animation/getting started welcome screen.

                                    I’ll look into that.

                                    So it isn’t a 100% flawless system.

                                    Still planning on doing a re-write… I’m just still wrapping my head around Win10 profiles and trying different things still.

                                    Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!
                                    Daily Clean Installation Results:
                                    https://fogtesting.fogproject.us/
                                    FOG Reporting:
                                    https://fog-external-reporting-results.fogproject.us/

                                    1 Reply Last reply Reply Quote 1
                                    • C
                                      csuther3
                                      last edited by

                                      This is a great post and the script is awesome! However, after multiple tests I’m finding that it does continue to break Cortana and the Start Menu on my image which is Win 10 Enterprise. It does seem to work as intended otherwise, as wallpaper, pinned taskbar programs and Firefox settings all seem to be in place.

                                      Wayne WorkmanW JJ FullmerJ 2 Replies Last reply Reply Quote 0
                                      • Wayne WorkmanW
                                        Wayne Workman @csuther3
                                        last edited by

                                        @csuther3 that’s strange. I tested on win10 enterprise and the start menu and search remains fine.

                                        Something that might help you: I noticed the files copied totaled about 40 ish MB.

                                        Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!
                                        Daily Clean Installation Results:
                                        https://fogtesting.fogproject.us/
                                        FOG Reporting:
                                        https://fog-external-reporting-results.fogproject.us/

                                        1 Reply Last reply Reply Quote 1
                                        • JJ FullmerJ
                                          JJ Fullmer Testers @csuther3
                                          last edited by

                                          @csuther3 Are you copying from a profile that already has cortana broken? Because it doesn’t fix it in that manner. You have to start with a fresh standard windows profile, then customize it.

                                          Have you tried the FogApi powershell module? It's pretty cool IMHO
                                          https://github.com/darksidemilk/FogApi
                                          https://fogapi.readthedocs.io/en/latest/
                                          https://www.powershellgallery.com/packages/FogApi
                                          https://forums.fogproject.org/topic/12026/powershell-api-module

                                          C 1 Reply Last reply Reply Quote 1
                                          • C
                                            csuther3 @JJ Fullmer
                                            last edited by

                                            @Arrowhead-IT No, Cortana and the Start Menu are both working fine in the source account, but once copied to the default profile Cortana and the Start Menu do not work for any new accounts. I tried creating the profile from a local user account as well as from a domain user account and it did not make a difference. I have my image in a VM so I can use a snapshot to quickly “unbreak” the default profile if you have any thoughts on things to try.

                                            JJ FullmerJ 1 Reply Last reply Reply Quote 1
                                            • 1
                                            • 2
                                            • 3
                                            • 4
                                            • 5
                                            • 2 / 5
                                            • First post
                                              Last post

                                            158

                                            Online

                                            12.0k

                                            Users

                                            17.3k

                                            Topics

                                            155.2k

                                            Posts
                                            Copyright © 2012-2024 FOG Project