Script to create a custom refresh image in Windows 8

Introduction

This PowerShell Script shows how to create custom refresh image.

Scenarios

The windows refresh feature does not enable you to create custom refresh points like Windows System Restore. Instead, refresh creates a Windows Installer Image that helps restore settings to the default state. This script lets users create custom refresh points.

Script

Step1: Run the script in the Windows PowerShell Console, type the following command at the prompt: Import-Module <Script Path> .

For example, type Import-Module C:\Script\ SetRefreshImage.psm1

This is shown in the following figure.

Step 2: This PowerShell module provides the following cmdlets:

  • New-OSCRefreshImage
  • Set-OSCRefreshReImage
  • Remove-OSCRefreshImage

You can type the command Get-Help “cmdlet” -Full to display the entire help file for this function, such as the syntax, parameters, or examples. For example Get-Help New-OSCRefreshImage -Full

  
Here are some code snippets for your references. To get the complete script sample, please click the download button at the beginning of this page.
PowerShell
Edit|Remove
If (Test-Path-Path $Path) 
{ 
    Write-Host "Setting the current custom recovery image..."-ForegroundColor Green 
    Invoke-Expression-Command "recimg /setcurrent $Path" 
} 
Else 
{ 
    Write-Warning"Cannot find path '$Path' because it does not exist." 
}

Example

Example 1: Type New-OSCRefreshImage -Path C:\Script command in the Windows PowerShell Console.
This command creates an image to the "C:\Script" Folder.

 
Example 2: In order to use the Refresh option in Windows 8, you have to set the WIM as the default refresh image once created.
Type the Set-OSCRefreshReImage -Path C:\Script command in the Windows PowerShell Console.
This command set the active recovery image to the CustomRefresh.wim file in the location by the "C:\Script" Folder.


 

 

Example 3: Type the Set-OSCTileRow -RowNumber 3 command in the Windows PowerShell Console.
This command will use default Refresh point will be used instead of your custom refresh image.

Prerequisite

Windows PowerShell 3.0
Windows 8