> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://helpdesk.ggcircuit.com/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# 🔄 Backing Up and Restoring Personal User Files (PUFs) for Client Machines

## 🧠 Overview

This guide explains how to back up and restore select user files and folders (Personal User Files, or PUFs) between your client machines and a network share. This setup is particularly useful in **diskless boot environments**, where user data is typically lost upon reboot.
---

## 🛠️ Problem
In environments using diskless boot technology, patron data such as saved games or personal configurations is lost when the client reboots. To provide a more persistent experience, you’ll need a way to retain and restore this data automatically.
---

## ✅ Solution

Implement a basic roaming-like profile system by creating scripts that:
* **Restore** user data from the network at login.
* **Back up** user data to the network at logout.

This is done via two simple batch scripts: `Login.bat` and `Logout.bat`.
> ⚠️ **Note:** File paths used in these scripts must be customized to match your specific game titles and client image layout. These are examples and may need modification.
---

## 💾 Sample Scripts
Store these scripts locally on the client machine and test from an Administrator Command Prompt to verify behavior.
---

## 🧰 How It Works
1. **A centralized** `SavePaths.txt` defines all pairs of network source and local destination paths.
2. **The** `Login.bat` **script** copies from network to local.
3. **The** `Logout.bat` **script** copies from local to network.
---

## 📄 `SavePaths.txt`

Each line contains a pair separated by a pipe (`|`):
```
\server\Save\AppData\Roaming\Goldberg UplayEmu Saves\13504|C:\Users\Administrator\AppData\Roaming\Goldberg UplayEmu Saves\13504
\server\Save\Offline\Call of Duty - Black Ops\players\save|E:\Offline\Call of Duty - Black Ops\players\save
\server\Save\AppData\Roaming\DarkSoulsIII|C:\Users\Administrator\AppData\Roaming\DarkSoulsIII
:: Add more lines as needed...
```
> Save this file as `SavePaths.txt` in the same folder as your scripts.

---

## 🔁 `Login.bat` (Network → Local)
```
@echo off
setlocal enabledelayedexpansion
:: Modify this to reflect your current working directory if needed
set "pathFile=SavePaths.txt"
set "user=%1"
for /f "usebackq tokens=1,2 delims=|" %%A in ("%pathFile%") do (
set "src=%%A\%user%"
set "dst=%%B"
echo Restoring from !src! to !dst!
xcopy /e /y /j /i "!src!" "!dst!" >nul
)
echo Login restore complete.
```
---

## 💾 `Logout.bat` (Local → Network)
```
@echo off
setlocal enabledelayedexpansion
:: Modify this to reflect your current working directory if needed
set "pathFile=SavePaths.txt"
set "user=%1"
for /f "usebackq tokens=1,2 delims=|" %%A in ("%pathFile%") do (
set "src=%%B"
set "dst=%%A\%user%"
echo Backing up from !src! to !dst!
xcopy /e /y /j /i "!src!" "!dst!" >nul
)
echo Logout backup complete.
```
---

## ⚙️ Integrating with ggLeap
1. **Log in to the** [**ggLeap Web Admin**](https://admin.ggleap.com/).
2. Navigate to: `Settings > Client Configuration > Advanced`.
3. Click **“Add Command”**.

### 🔁 Add Login Script Command

* **Command Name**: `RestorePUF`
* **Full Path**: `C:\Path\To\Login.bat`
* Click **“Save”**.

### 💾 Add Logout Script Command

* **Command Name**: `BackupPUF`
* **Full Path**: `C:\Path\To\Logout.bat`
* Click **“Save”**.

> ⚠️ **Ensure the full path is correct** — otherwise the scripts won't execute.

4. Click **“Save Changes”** to apply the configuration.
---
## 📌 Important Notes

* If you’re running a **diskless image**, make sure to **commit these script changes to your master image**.
* Make sure your network share is reliably accessible at login/logout time.
* Test scripts thoroughly in a sandbox before deploying to all machines.
---

## 📌 Bonus Community-Provided Ludusavi Game-Save Backup & Restore Tool

**Overview**  
To streamline game-save portability for our café and campus computers, we’ve added a dedicated **Ludusavi** entry in the Games DB. Ludusavi is an open-source game-save manager that leverages the PCGamingWiki API to maintain an up-to-date catalog of save-file locations. It’s developed and maintained by a large community, and it’s completely license-free—please consider supporting the developer!
---

##### Prerequisites

* **ggRock** image with PowerShell support
* Campus license of **SAPIEN PowerShell** (to package the wrapper as a portable `.exe`)
* USB storage device formatted with a supported file system (e.g., NTFS)
---

##### Installation & Configuration

1. **Deploy the Wrapper**
* Clone or download the wrapper repository:

```
git clone https://github.com/Skylancer187/Gaming-Automations.git
```

* Build the PowerShell script into an executable using SAPIEN PowerShell Studio.
* Copy the resulting `Ludusavi-Wrapper.exe` to your GGLeap image.

2. **Map the App in GGLeap**
* In the GGLeap Admin Console, navigate to **Settings → Client Configuration → Games/Apps**.
* Locate the Ludusavi app.
* Point the “Executable Path” to `Ludusavi-Wrapper.exe`.
* Assign any needed launch parameters (none required by default).
---

##### Using the Tool 🔄

When launched on a café or campus machine, the wrapper will:

1. **Fetch Latest Ludusavi**
* Automatically download the newest Ludusavi release from GitHub.

2. **Detect USB Drive**
* Wait for a USB device to be plugged in.

3. **Choose Operation**
* Prompt the user to **Backup** or **Restore** save files under `\<USB-root>\ludusavi`.

4. **Run Ludusavi CLI**
* Execute the appropriate Ludusavi command to copy game saves to/from the USB.

5. **Archive Wrapper Version**
* Copy the currently used Ludusavi executable to the root of the USB drive so the user always has the same version for future use.

---

##### Why Use Ludusavi?

* **Broad Coverage** – Supports hundreds of PC games that lack built-in cloud saves.
* **Up-to-Date** – Uses the PCGamingWiki API to keep save-file paths current.
* **Portable** – Runs from any USB stick without admin-level installation.
* **Free & Open-Source** – No licensing costs; community-driven.

---

##### Resources & Support

* **Wrapper Source Code**: [https://github.com/Skylancer187/Gaming-Automations](https://github.com/Skylancer187/Gaming-Automations)
* **Ludusavi Project**: [https://github.com/mtkennerly/ludusavi](https://github.com/mtkennerly/ludusavi)
* **Game-Save Locations Reference**: [https://www.pcgamingwiki.com/wiki/Home](https://www.pcgamingwiki.com/wiki/Home)