top of page
Search

(178) Microsoft Intune - User Profile Backup & Restore and Windows Easy Transfer

  • Writer: Mr B SOE way
    Mr B SOE way
  • Sep 3
  • 3 min read

From 3 years ago, I did a blog around https://soeintunedevice.wixsite.com/home/post/34-backup-restore-win32-app using batch files from a previous customer and previous MSP life. This time around, I have brought it back to life with using 'PowerShell':


  • User Profile Backup from PC to OneDrive

    • Backups Chrome favourites

    • Backups Edge favourites

    • Backups Signatures

  • User Profile Restore from OneDrive to PC

    • Restores backup for Chrome favourites

    • Restores backup for Edge favourites

    • Restores backup for Signatures


As well as a personal favourite which I used during my corporate days "Windows Easy Transfer" which was very popular during the Windows 7 days.


With User Profile Backup from PC to OneDrive - User Context app



You just need to find and replace "MR B SOE Way" with your OneDrive variables



#region Config
$AppName = $PName + "_"+ $Pversion +"_Package"
$client = "Mr B SOE Way"
$logPath = "$env:ProgramData\$client\logs"
$logFile = "$logPath\Backup Chrome Edge Signatures to OneDrive.log"

#endregion
#region Logging
if (!(Test-Path -Path $logPath)) {
    New-Item -Path $logPath -ItemType Directory -Force | Out-Null
}


Start-Transcript -Path $logFile -Force

Write-Host "Backup Chrome Edge Signatures to OneDrive...."

# Create a tag file just so Intune knows this was installed
    if (-not (Test-Path "$($env:ProgramData)\MrB\Backup")) {
        Mkdir "$($env:ProgramData)\MrB\Backup"
    }
    Set-Content -Path "$($env:ProgramData)\MrB\Backup\Backup.ps1.tag" -Value "Installed"



#creates folders in Onedrive
New-item -path "$env:USERPROFILE\OneDrive - Toyota Finance Australia LTD\Documents\Backup" -ItemType Directory
New-item -path "$env:USERPROFILE\OneDrive - Toyota Finance Australia LTD\Documents\Backup\Edge" -ItemType Directory
New-item -path "$env:USERPROFILE\OneDrive - Toyota Finance Australia LTD\Documents\Backup\Chrome" -ItemType Directory
New-item -path "$env:USERPROFILE\OneDrive - Toyota Finance Australia LTD\Documents\Backup\Signatures" -ItemType Directory

#Copies from device to OneDrive
Copy-Item -Path "$env:USERPROFILE\AppData\Local\Microsoft\Edge\User Data\Default\Bookmarks" -Destination "$env:USERPROFILE\OneDrive - Toyota Finance Australia LTD\Documents\Backup\Edge"
Copy-Item -Path "$env:USERPROFILE\AppData\Local\Google\Chrome\User Data\Default\Bookmarks" -Destination "$env:USERPROFILE\OneDrive - Toyota Finance Australia LTD\Documents\Backup\Chrome"
Copy-Item -Path "$env:USERPROFILE\AppData\Roaming\Microsoft\Signatures\*" -Destination "$env:USERPROFILE\OneDrive - Toyota Finance Australia LTD\Documents\Backup\Signatures"

Write-Host "Script completed successfully.."
Stop-Transcript

if (test-path "C:\ProgramData\MrB\Backup\Backup.ps1.tag"){"Installed"} 

What to expect from the above, it will create these folders and backup the contents:

ree

With User Profile Restore from OneDrive to PC - User Context app



You just need to find and replace "MR B SOE Way" with your OneDrive variables



#region Config
$AppName = $PName + "_"+ $Pversion +"_Package"
$client = "MR B SOE Way"
$logPath = "$env:ProgramData\$client\logs"
$logFile = "$logPath\Restore Chrome Edge Signatures to PC.log"

#endregion
#region Logging
if (!(Test-Path -Path $logPath)) {
    New-Item -Path $logPath -ItemType Directory -Force | Out-Null
}


Start-Transcript -Path $logFile -Force

Write-Host "Restore Chrome Edge Signatures to PC...."

# Create a tag file just so Intune knows this was installed
    if (-not (Test-Path "$($env:ProgramData)\MrB\Restore")) {
        Mkdir "$($env:ProgramData)\MrB\Restore"
    }
    Set-Content -Path "$($env:ProgramData)\MrB\Restore\Backup.ps1.tag" -Value "Installed"



#Copies from device to OneDrive
Copy-Item -Path "$env:USERPROFILE\OneDrive - MR B SOE Way\Documents\Backup\Edge\*" -Destination "$env:USERPROFILE\AppData\Local\Microsoft\Edge\User Data\Default\Bookmarks"
Copy-Item -Path "$env:USERPROFILE\OneDrive - MR B SOE Way\Documents\Backup\Chrome\*" -Destination "$env:USERPROFILE\AppData\Local\Google\Chrome\User Data\Default\Bookmarks"
Copy-Item -Path "$env:USERPROFILE\OneDrive - MR B SOE Way\Documents\Backup\Signatures\*" -Destination "$env:USERPROFILE\AppData\Roaming\Microsoft\Signatures\"

Write-Host "Script completed successfully.."
Stop-Transcript


if (test-path "C:\ProgramData\MrB\Restore\Backup.ps1.tag"){"Installed"} 

With Windows Easy Transfer:


It will create a folder using a batch file, then PowerShell will trigger it:


Install.cmd - this will copy all the contents with the "WindowsEasyTransfer" folder onto the PC


cmd.exe /c md C:\WindowsEasyTransfer & cmd.exe /c xcopy ".\WindowsEasyTransfer" C:\WindowsEasyTransfer  /y /e
ree



    #region Config
    $AppName = "Windows Easy Transfer"
    $client = "MR B SOE Way"
    $logPath = "$env:ProgramData\$client\logs"
    $logFile = "$logPath\$appName.log"
    
    $cmdcommands = ".\Install.cmd"

    #endregion
    #region Logging
    if (!(Test-Path -Path $logPath)) {
        New-Item -Path $logPath -ItemType Directory -Force | Out-Null
    }


    Start-Transcript -Path $logFile -Force

    Start-Process -FilePath "cmd.exe" -ArgumentList "/c `"$cmdcommands`"" -nonewwindow -Wait


     Write-Host "Script completed successfully.."
     Stop-Transcript
     Exit 
 


if (test-path "C:\WindowsEasyTransfer"){"Installed"} 

The files for Windows Easy Transfer can be found here in Github. Once installed, it will appear here in C:\WindowsEasyTransfer

ree

Start the MigWiz.exe which brings you here - you will need administrative rights to run it.

ree

It will then start scanning and doing the backup depending on what you choose.

ree

In this case, I select 'An external hard disk or USB flash drive"

ree

 
 
 

Comments


bottom of page