PSImage - Alternative Windows Imaging

This is a concept that Professional Services created that uses Microsoft tools and ties into FileWave. This is not supported as a solution by Technical Support but is being shared so someone could use the ideas and concepts if they are helpful. Discussion in Discord can help further these ideas.

Introducing PSImage

PSImage is an alternative disk imaging solution built on PowerShell scripts intended for environments where it is not feasible to use the IVS, such as;

It uses off-the-shelf Microsoft components, such as WinPE and DISM from the Windows ADK. It requires you to be comfortable connecting to SMB shares and running commands from PowerShell and CMD sessions.

PSImage is not supported by FileWave Support so please do not submit tickets with them about it. The information provided here is for educational purposes only. If you would like to purchase professional services hours for consulting assistance setting up PSImage or customizing it please contact professional.services@filewave.com with your request. If you have existing unused professional services hours you may be able to use them for this purpose. Any feedback on PSImage can also be sent to the same email address. Any work on this would be done on Discord or in working with Professional Services. For the official Windows Imaging solution please see Network Imaging / IVS.

Benefits

PSImage has the following benefits that you may or may not be able to take advantage of, depending on your environment and network configuration.

Components

There are 2 components to the disk imaging.

  1. An SMB share hosting the scripts, disk images, and driver packs for the disk imaging.
  2. A bootable WinPE boot image (boot.wim) that can be deployed on client PCs to be reimaged via

Since PXE is optional and not required there's no need for network modifications of any kind. As long as the client device is able to boot from a USB thumb stick or has a functional FileWave client installed it can be imaged. For baremetal imaging of PCs with no OS or blank hard drives, use the bootable USB thumb stick, PXE boot, or optical media options. For the non-PXE boot options, any NIC, including those that do not support PXE will work as long as you have Windows 10 drivers for them.

Components (PSImage)

PSImage is not supported by FileWave Support so please do not submit tickets with them about it. The information provided here is for educational purposes only. If you would like to purchase professional services hours for consulting assistance setting up PSImage or customizing it please contact professional.services@filewave.com with your request. If you have existing unused professional services hours you may be able to use them for this purpose. Any feedback on PSImage can also be sent to the same email address. Any work on this would be done on Discord or in working with Professional Services. For the official Windows Imaging solution please see Network Imaging / IVS.

3 Phases of Disk Imaging

image.png


When imaging over the network from the psimage network share there are 3 phases. The above diagram describes what happens during each phase and the info below describes which script is responsible for the actions during each phase.

  1. Pre-imaging (x:\imaging\go.ps1) - Gets connection info from config.ini automatically or prompt user about server hosting SMB share and then connect to it
  2. Imaging (z:\scripts\PSImage.ps1) - Capture or restore disk image
  3. Post-imaging (z:\scripts\runonce.ps1) - Post-imaging actions like setting the computername, installing the FW client, adding client firewall exception, importing a Wi-Fi profile. There are 2 reboots.

Pre-imaging Components in WinPE

boot.wim holds WinPE and is the imaging environment you're booting into to gain full access to the local hard drive. You'll learn how to build boot.wim later in Building Your Imaging Environment. You can also find boot.wim in the sources folder in the WinPE partition of the USB thumb stick, as well as in your reimaging fileset and the WDS server (if you decide to use PXE). To edit it you must mount the boot.wim WIM image, make your edits, and commit your changes to unmount it. While mounted the contents are mapped to a folder you designate on the local drive. The following files reside in the boot.wim file in the \imaging folder.

Imaging/Post-imaging Components

The following folders are present on the psimage share for network imaging or the secondary Imaging volume on the USB thumb drive for local imaging. These are used during the imaging and post-imaging process. When booted into the WinPE imaging environment the psimage share or 2ndary volume of your dual-partitioned USB thumb drive is mapped to as the z: drive. WinPE itself is mounted as the x: drive.

Other Misc Items

There are 2 spots with hidden options for troubleshooting. Enter "z" to drop to command line in imaging phase in WinPE at

  1. Main PSImage menu and
  2. When asked to press Return to reboot after successful image capture.

C:\Windows\Temp\restore.done created immediately before last reboot. Use this file in requirement scripts to postpone filesets until post-imaging is complete.

Beginning and ending imaging times are written to registry of reimaged client at HKLM\Software\PSImage.  Name of image used to reimage PC is also written here. Custom field data specified in image_mappings.txt will also be written here if if the client device is reimaged using any other method besides via fileset.

Post-imaging log is written to c:\windows\temp\psimage.log on client device. If you don't end up at login prompt then check here to see where it failed as post-imaging process did not complete.

Building Your Imaging Environment (PSImage)

PSImage is not supported by FileWave Support so please do not submit tickets with them about it. The information provided here is for educational purposes only. If you would like to purchase professional services hours for consulting assistance setting up PSImage or customizing it please contact professional.services@filewave.com with your request. If you have existing unused professional services hours you may be able to use them for this purpose. Any feedback on PSImage can also be sent to the same email address. Any work on this would be done on Discord or in working with Professional Services. For the official Windows Imaging solution please see Network Imaging / IVS.

Build Your WinPE boot.wim

  1. Download the latest ADK for Windows 11. Scroll down to the "Other ADK downloads" section and download the "Windows PE add-on for the ADK for Windows 11".
  2. Install the ADK, keep the default installation path, and check the "Deployment Tools" and "User State Migration Tool (USMT)" components.
  3. Install the Windows PE add-on.
  4. Find the Windows Kits program folder in the Windows Start menu and launch the "Deployment and Imaging Tools Environment" as an administrator.
  5. Enter the following commands below in the Deployment and Imaging Tools shell.
    copype amd64 C:\WinPE_amd64
    Dism /Mount-Image /ImageFile:"C:\WinPE_amd64\media\sources\boot.wim" /Index:1 /MountDir:"C:\WinPE_amd64\mount"
    Dism /Add-Package /Image:"C:\WinPE_amd64\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-WMI.cab"
    Dism /Add-Package /Image:"C:\WinPE_amd64\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\en-us\WinPE-WMI_en-us.cab"
    Dism /Add-Package /Image:"C:\WinPE_amd64\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-NetFX.cab"
    Dism /Add-Package /Image:"C:\WinPE_amd64\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\en-us\WinPE-NetFX_en-us.cab"
    Dism /Add-Package /Image:"C:\WinPE_amd64\mount" /Packagepath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\winpe-scripting.cab" 
    Dism /Add-Package /Image:"C:\WinPE_amd64\mount" /Packagepath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\en-us\winpe-scripting_en-us.cab"
    Dism /Add-Package /Image:"C:\WinPE_amd64\mount" /Packagepath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-PowerShell.cab"
    Dism /Add-Package /Image:"C:\WinPE_amd64\mount" /Packagepath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\en-us\WinPE-PowerShell_en-us.cab"
    Dism /Add-Package /Image:"C:\WinPE_amd64\mount" /Packagepath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\winpe-wds-tools.cab" 
    Dism /Add-Package /Image:"C:\WinPE_amd64\mount" /Packagepath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\en-us\winpe-wds-tools_en-us.cab" 
    Dism /Add-Package /Image:"C:\WinPE_amd64\mount" /Packagepath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\winpe-wmi.cab"
    Dism /Add-Package /Image:"C:\WinPE_amd64\mount" /Packagepath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\en-us\winpe-wmi_en-us.cab"
    
  6. Edit C:\WinPE_amd64\mount\Windows\System32\startnet.cmd and replace the contents with the block below. You may have to copy the file to your desktop first, edit the copy, and then copy it back into the System32 folder to overwrite the original.
    @echo off
    wpeinit
    cd \imaging
    \windows\system32\windowspowershell\v1.0\powershell.exe -ExecutionPolicy Bypass -File go.ps1
    
  7. Create a folder C:\WinPE_amd64\mount\imaging.
  8. Add this go.ps1 file to the C:\WinPE_amd64\mount\imaging folder.
  9. Create a C:\WinPE_amd64\mount\imaging\config.ini file with the following contents. Make sure you set File Explorer to display file extensions. The icon for the file should look like a blank sheet of paper with a gear in the lower left corner.
    [admin]
    mode=standard
    [autologin]
    autousername=fwadmin
    autopassword=filewave
    [share]
    server=prompt
    share=prompt
    domain=filewavecorp
    username=fwadmin
    password=filewave
    [path]
    image_path=z:\images
    driver_path=z:\models
    msi_path=z:\fwclient
    script_path=z:\scripts
    config_path=z:\config
    history_path=z:\logs
    log_path=z:\logs
    util_path=z:\utils
    extra_path=z:\extra
    
  10. If you want to gate WinPE so that a password is required to access the imaging environment, add a file at C:\WinPE_amd64\mount\imaging\password.txt and add your password in it. Make sure there is no white space before nor after the password.
  11. Close all text editors and File Explorer windows to ensure that there are no open files on the mount point for boot.wim.
  12. Commit your changes and unmount the WIM image with
    dism /unmount-image /mountdir:C:\WinPE_amd64\mount /commit
    
  13. Your WinPE boot.wim file is available at "C:\WinPE_amd64\media\sources\boot.wim".

Editing Pre-imaging Components in WinPE

WinPE is contained in the boot.wim file and holds the config.ini that has your pre-imaging and imaging configuration data. This info tells the disk imaging where to find various resources. It must be customized for your environment. To mount and edit the boot.wim file

  1. Open a CMD prompt with admin privileges and run
    dism /mount-image /ImageFile:"C:\WinPE_amd64\media\sources\boot.wim" /Index:1 /MountDir:"C:\WinPE_amd64\mount"
    
  2. Browse to C:\WinPE_amd64\mount\imaging and edit config.ini or add/remove password.txt. The password inside password.txt, if this file is present, is used to restrict unauthorized access.
  3. Close all Windows Explorer windows. Make sure neither config.ini nor password.txt are open in an editor. Otherwise the unmount will fail.
  4. Commit changes to WIM and unmount with
    dism /unmount-image /mountdir:C:\WinPE_amd64\mount /commit
    

Below is a sample config.ini with explanations. Notes are surrounded by parentheses and are not present in the actual config.ini.

[admin]
mode=standard (set to "usb" => for local imaging on dual partitioned USB thumb stick)

[autologin] (do not change, credentials for temp admin account used to autologin for post-imaging, account deleted when imaging complete)
autousername=fwadmin 
autopassword=filewave

[share] (credentials for accessing the psimage share for reimaging)
server=myserver (if set to "prompt" => go.ps1 will prompt for server address hosting psimage share in multi-location/server env)
share=psimage (if set to "prompt" => go.ps1 will prompt user for the domain, username, and password in a multi-location/server env)
domain=filewavecorp (change as needed)
username=fwadmin (change as needed)
password=filewave (change as needed)

[path] (do not change these unless instructed to do so)
image_path=z:\images
driver_path=z:\models
msi_path=z:\fwclient
script_path=z:\scripts
config_path=z:\config
history_path=z:\logs
log_path=z:\logs
extra_path=z:\extra

Creating a bootable ISO

Follow the instructions in the section above titled "Editing Pre-imaging Components in WinPE" to ensure that your config.ini is set up correctly with "mode=standard". Go to Windows Kits, start the "Deployment and Imaging Tools Environment" as an administrator, and run the following command.

MakeWinPEMedia /ISO C:\WinPE_amd64 C:\WinPE_amd64\WinPE_amd64.iso

Setting up your bootable USB thumb stick

Follow the instructions in the section above titled "Editing Pre-imaging Components in WinPE" to ensure that your config.ini is set up correctly with "mode=standard" and a password.txt if desired.

  1. Insert a USB thumb stick.
  2. Open a CMD session with admin privileges.
  3. Launch diskpart and enter the following series of commands. Run "list disk" at the diskpart prompt to determine the number assigned to your thumb drive, usually 1 unless your PC has more than one disk drive. 0 is normally the designation for your boot drive, which is typically the hard disk you're booted into.
    select disk 1
    clean
    create partition primary size=750
    active
    format fs=FAT32 quick label="WinPE"
    assign letter=P
    exit
    
  4. To create a bootable USB thumb drive run
    xcopy C:\WinPE_amd64\media P:\ /s
    

Setting up a dual-partitioned USB thumb stick for local imaging

Follow the instructions in the section above titled "Editing Pre-imaging Components in WinPE" to ensure that your config.ini is set up correctly with "mode=usb" and a password.txt if desired.

  1. Insert a USB thumb stick.
  2. Open a CMD session with admin privileges.
  3. Launch diskpart and enter the following series of commands. Run "list disk" at the diskpart prompt to determine the number assigned to your thumb drive, usually 1 unless your PC has more than one disk drive. 0 is normally the designation for your boot drive, which is typically the hard disk you're booted into.
    select disk 1
    clean
    create partition primary size=750
    active
    format fs=FAT32 quick label="WinPE"
    assign letter=P
    create partition primary
    format fs=NTFS quick label="Imaging"
    assign letter=I  
    exit
    
  4. Copy the WinPE files to the bootable FAT32 partition of the USB thumb stick with
    xcopy C:\WinPE_amd64\media P:\ /s
    
  5. Copy the contents of the PSImage_v0.3.zip file to the root level of the I: drive.

Cloning your USB thumb stick

Once you have your USB thumb sticks configured the way you like them use ImageUSB to take an image of it. This image can then be written to any other thumb drive, as long as the target thumb drive is the same size or larger than the original. For local disk imaging the secondary NTFS volume on the thumb drive will be expanded to consume all available space when you check “Extend/Add Partition (NTFS only)”.

Adding your boot.wim to WDS for PXE booting

This method can be used for both capturing the master image and restoring it to target PCs.

  1. Follow the instructions in the section above titled "Editing Pre-imaging Components in WinPE" to ensure that your config.ini is set up correctly with "mode=standard" and a password.txt if desired.
  2. Copy the boot.wim file to your WDS server.
  3. Add the WDS feature to your Windows Server. These instructions are for Windows 2019 but will be very similar for other versions of Windows Server.
  4. Go to Windows Administrative Tools > Windows Deployment Services.
  5. Navigate to Servers > LocalServerName, right-click and pick Configure Server.
  6. For testing, pick Standalone server but yours may already be Integrated with Active Directory.
  7. Leave C:\RemoteInstall for the remote installation folder.
  8. Choose Respond to all client computers (known and unknown) unless you already know what you are doing and want to restrict PXE booting.
  9. Uncheck Add images to the server now check and click Finish button.
  10. Navigate to Servers > LocalServerName > Boot Images on the left, right-click on the right and pick Add Boot Image.
  11. Specify your customized boot.wim file as the boot image. Note that PXE booting is significantly slower with BIOS systems than UEFI ones.

Deployment and Workflow (PSImage)

Deployment and Workflow (PSImage)

Deployment and Workflow Overview (PSImage)

PSImage is not supported by FileWave Support so please do not submit tickets with them about it. The information provided here is for educational purposes only. If you would like to purchase professional services hours for consulting assistance setting up PSImage or customizing it please contact professional.services@filewave.com with your request. If you have existing unused professional services hours you may be able to use them for this purpose. Any feedback on PSImage can also be sent to the same email address. Any work on this would be done on Discord or in working with Professional Services. For the official Windows Imaging solution please see Network Imaging / IVS.

As mentioned before there are 2 components to the disk imaging - 1) an SMB share and 2) a bootable WinPE WIM image - boot.wim. To set up the disk imaging you'll need to

  1. Set up the psimage share for access over the network and grant adequate share access.

  2. Make the boot.wim available to your client device to be reimaged. There are 4 different ways to do this. Any or all of these methods can be used at the same time to reimage client PCs.

  3. Deploy boot.wim with a fileset and have it load via RAM disk (requires device have functional FileWave client installed).

  4. Create a bootable USB thumb drive. There are 2 versions of the thumb drive. See Building Your Imaging Environment for instructions.

    1. A single partition thumb drive to host boot.wim for network imaging. Disk images and driver packs are pulled from the psimage share.
    2. A dual partition thumb drive for local imaging. The first partition hosts boot.wim. Disk images and driver packs are pulled from a secondary partition on the same thumb drive. In this case there is no interaction with the psimage share. However, network access must still be available during post-imaging so the FileWave client can send in an initial inventory to the FileWave server to trigger the creation of client device entry.
  5. Make boot.wim available to PXE clients over the network with a PXE server such as WDS.

  6. Create a bootable ISO that hosts boot.wim. See Building Your Imaging Environment for instructions. This can be used to boot a VM for image capture. It can also be burned to optical media for older devices that have an optical drive for image restoration.

  7. Prepare your reference computer, VM or physical, for image capture using the provided prep_ref_vm.ps1 script. This will syprep it.

  8. Boot your reference VM from the ISO, or a physical PC from a thumb stick or the network to capture a master image.

  9. Upload driver packs from each PC model you need to reimage using the upload_driver_pack.ps1 script.

  10. Add the customized FileWave client and any optional kiosk customizations.

  11. Add a Wi-Fi profile for laptops without a built-in ethernet NIC.

  12. Optionally pre-assign disk images, computernames, and custom field values to client PCs via image_mappings.txt. If there is no association, tech will be prompted for disk image and computername.

  13. Boot PC from USB thumb stick, network, or via fileset to reimage it.

Setting up the psimage share

  1. Extract the contents of the PSImage_v0.3.zip file to a folder.
  2. Share that folder with share name of psimage.
  3. Grant Everyone Full Control share permissions.
  4. Create a domain account account, e.g. fwadmin, and grant it Modify NTFS security permissions to this folder.
  5. From another PC, verify that you can connect to the the psimage share using the above domain account.
Deployment and Workflow (PSImage)

Capturing a Master Image (PSImage)

PSImage is not supported by FileWave Support so please do not submit tickets with them about it. The information provided here is for educational purposes only. If you would like to purchase professional services hours for consulting assistance setting up PSImage or customizing it please contact professional.services@filewave.com with your request. If you have existing unused professional services hours you may be able to use them for this purpose. Any feedback on PSImage can also be sent to the same email address. Any work on this would be done on Discord or in working with Professional Services. For the official Windows Imaging solution please see Network Imaging / IVS.

Prepping your reference PC (VM or physical) for image capture

  1. Set up a VM or physical PC and install Windows 10 x64 or Windows 11 x64. Please note that older versions and 32-bit versions of Windows have not been tested and will likely not work with this solution. The first account you create during Windows setup will be your default local administrator account that will remain on your PCs after reimaging.
  2. Place your unattend.xml sysprep answer file in the sysprep folder on the psimage share or the Imaging volume of your USB thumb stick (if imaging locally). You can use this generic answer file if you do not already have one. Edit the file in a text editor to adjust the time zone. Do not include domain join information in your sysprep answer file. That should be handled as a fileset. The device rename happens post-imaging with the local fwadmin account which is not able to modify Active Directory.
  3. Install all missing Windows updates to clear out the reserved storage. Sysprep will fail on Windows 11 if there are any pending OS updates stored in the reserved storage. If your reference system is a VM, it's probably a good idea to take a VM snapshot now after all OS updates have been installed but before the system has been sysprepped.
  4. Open a PowerShell session with admin privileges, connect to the psimage share, and navigate to the sysprep folder. If imaging locally change directory to the sysprep folder on the Imaging volume of the USB thumb stick.
  5. Run the prep_ref_vm.ps1 script. It will create a fwadmin account with a password of "filewave". You may have to set the execution policy to bypass so you can run PowerShell scripts.
  6. Log out of the reference system and log back in as fwadmin. This lets you skip the new user login assistant during post-imaging on reimaged clients.
  7. Log out and log back in under the default local admin account. In a PowerShell session with admin privileges connect to the psimage share and run prep_ref_vm.ps1 again to sysprep. If imaging locally change directory to the sysprep folder on the Imaging volume of the USB thumb stick instead.
  8. If sysprep fails, run remove_app.ps1 from the the sysprep folder to view the setuperr.log and review error messages.
    1. If the failure was due to reserved storage being in use, check Windows Update and install all remaining updates.
    2. If the failure was due to an application being installed for a user but not provisioned for all users, remove it using the Remove app option in remove_app.ps1. Repeat this step until sysprep runs successfully.
  9. The system will shut down upon successful sysprep.
  10. If this is a VM, it's probably a good idea to take a snapshot of the VM in its shut down sysprepped state in case the reference VM ends up booting into the OS for some reason, as the OOBE can take a while to complete before you can re-sysprep again.

Capturing a master image from a reference VM

  1. Attach the WinPE_amd64.iso file you built previously to your Windows VM and boot from it.
  2. You may be prompted to enter the name of the server, share name, and credentials, depending on how config.ini is set up.
  3. At the main PSImage menu select the option to capture a disk image.

To edit your existing ISO

If you need to make changes to your imaging environment in the boot.wim within the ISO for any reason, follow the steps below.

  1. Download and install AnyBurn.
  2. Pick Browse/Extract image file.
  3. Select the WinPE_amd64.iso file and click the Open button.
  4. Browse to CD_ROM\Sources, select boot.wim, and click Next button.
  5. Select desktop folder, check Extract only selected files and folders, and click Next button.
  6. Mount the boot.wim file, and modify the config.ini with the instructions at Building Your Imaging Environment. You will have to change the "/ImageFile:" argument to point to the path of your boot.wim file extracted from the ISO.
  7. Open WinPE_amd64.iso in AnyBurn, delete the existing boot.wim file, and the use the Add button to replace it with the updated boot.wim file you just edited.
  8. Output the changes to the existing ISO and overwrite it.

Capturing a master image from a physical reference PC

  1. PXE boot the PC or boot it from a USB thumb stick.
  2. You may be prompted to enter the name of the server hosting the psimage share, depending on how config.ini is set up.
  3. At the main PSImage menu select the option to capture a disk image.
Deployment and Workflow (PSImage)

Configuration (PSImage)

PSImage is not supported by FileWave Support so please do not submit tickets with them about it. The information provided here is for educational purposes only. If you would like to purchase professional services hours for consulting assistance setting up PSImage or customizing it please contact professional.services@filewave.com with your request. If you have existing unused professional services hours you may be able to use them for this purpose. Any feedback on PSImage can also be sent to the same email address. Any work on this would be done on Discord or in working with Professional Services. For the official Windows Imaging solution please see Network Imaging / IVS.

Adding the FileWave Client

  1. Using File Explorer, navigate to the fwclient folder on the psimage share or the Imaging volume on your thumb stick.
  2. Right-click upload_client.ps1 and choose "Run with PowerShell".
  3. upload_client.ps1 will write a fw_client_version.txt file to the sysprep folder so you know the version of your customized FileWave client that is being installed on client devices during post-imaging. This allows you to update the FileWave client without having to recapture your master image.
  4. If you have files for kiosk customization create a subfolder named "custom" within the fwclient folder and add those files there. They will be deployed automatically immediately after the FileWave client is installed during post-imaging.

Adding drivers for computer models

  1. On the computer model you wish to capture drivers for, open a PowerShell session with admin privileges, connect to the psimages share, and navigate to the models folder. If imaging locally change directory to the models folder on the Imaging volume of the USB thumb stick.
  2. Run the upload_driver_pack.ps1 script to extract 3rd party non-Microsoft drivers. A folder named after the computer model will be created in models folder on the psimage share containing the extracted drivers.

Custom field setup

Set the FileWave server address and app token with the instructions below. You can also set them using the edit_config.ps1 script in the config folder on the psimage share.

  1. Within the config folder on the psimage share create a server.dns file that contain the DNS address for your FileWave server.
  2. Within the config folder on the psimage share create an app.token file that contain the base64 API token for a FileWave admin account that has at least permission to "Modify Custom Fields".

Pre-assigning computer names and disk images

  1. Browse to the config folder on the psimage share or Imaging volume of the USB thumb drive.
  2. Edit image_mappings.txt to pre-assign disk images and computernames to client devices by serial number. To avoid syntax issues from missing commas it is recommended you edit this file with a spreadsheet or CSV editing app. Entries should be in the format below. If no mapping is available or a client PC or the assigned disk image does not exist, you'll be prompted to enter a disk image name.
    Serial Number,Computer Name,Image Name
    1a2b3c4d,test-restore,image.wim
    
  3. There should be no spaces in the serial number, computer name, and image name fields and they should be separated by commas. Computernames should meet Windows naming requirements and should be 15 characters or less. If testing with a VMware VM, remove all spaces from the VM serial number when adding an entry for it. There must be one blank line at the end of the line.
  4. If you would like to set custom fields by their internal name, add them at the end after the image name. Custom fields need to be referenced by their internal names, followed by a colon, and then the value to set. The value for the custom field can have spaces in it, as illustrated in the example below. Only custom fields of the string data type are supported.
    1a2b3c4d,test-restore,image.wim,school:Washington Elementary,grade:5,classroom:218,user_type:student
    
  5. If the assigned disk image is set to "capture" for a particular PC in image_mappings.txt while \config\mode.reimage is present, it will attempt to capture a disk image instead of restoring one.

Adding a Wi-Fi profile

For laptops that do not have a built-in ethernet port, you may prefer to switch to Wi-Fi as soon as possible for the post-imaging phase. This allows you to disconnect your USB ethernet dongle/dock so it can used to reimage additional PCs. Remember that post imaging requires network access so the FileWave client can send in an initial inventory to the FileWave server to trigger the creation of a client entry. This network access can be via wireless and does not have to be a wired connection.

  1. Configure a test PC to connect to your Wi-Fi.
  2. Run the following command to list available profiles.
    netsh wlan show profiles
    
  3. Use the command below to export the desired profile to the current folder. Change ProfileName to the name of the profile from the list displayed in the previous step. Note that this will store the password for the wireless connection in clear text. The Wi-Fi profile will be deleted from the client system after import during post-imaging.
    netsh wlan export profile name="ProfileName" key=clear folder="%cd%"
    
  4. Rename this profile to Wi-Fi.xml and copy it to the extra folder in the psimage share.

Changing configuration settings via edit_config.ps1

A text-based GUI is available for viewing and configuring many of the settings for PSImage. Navigate to the config folder on the psimages share, right-click edit_config.ps1, and choose "Run with PowerShell".

image.png

Deployment and Workflow (PSImage)

Custom Post-Imaging Actions (PSImage)

PSImage is not supported by FileWave Support so please do not submit tickets with them about it. The information provided here is for educational purposes only. If you would like to purchase professional services hours for consulting assistance setting up PSImage or customizing it please contact professional.services@filewave.com with your request. If you have existing unused professional services hours you may be able to use them for this purpose. Any feedback on PSImage can also be sent to the same email address. Any work on this would be done on Discord or in working with Professional Services. For the official Windows Imaging solution please see Network Imaging / IVS.

PSimage includes a mechanism for you to add post-imaging actions to the imaging workflow. These are executed by the to_do.bat file in the scripts folder of the psimage share and run with admin privileges under the context of the temporary local fwadmin account. This account is deleted at the end of the post-imaging phase. Custom post-imaging actions are enabled via 2 mechanisms:

  1. The contents of the extra folder in the psimage share is copied to c:\windows\temp\psimage. Place any files/folders here that you want to be copied to the reimaged PC and run during the post-imaging phase. The c:\windows\temp\psimage folder will be deleted automatically from the reimaged PC at the end of the post-imaging phase.
  2. Use the to_do.bat file in the scripts folder of the psimage share to trigger any built-in Windows utilities or executables/installers that have been copied to c:\windows\temp\psimage. Note that the post-imaging phase does not have access to the the psimage share but only to the files copied to c:\windows\temp\psimage. If there are any commands that must be run or apps that must be installed immediately ASAP after reimaging, add them to the extra folder and trigger them via to_do.bat as necessary.

Please take note of the tips outlined in the sample to_do.bat for how to trigger apps. There is a reboot at the end of the post-imaging phase so be sure to launch executables with "start /wait", particularly installers, so that the to_do.bat waits for them to finish before moving on to the next item in the script. Otherwise the system might reboot prematurely before your executable/installer has had a chance to finish running. If you need to deploy files to the hard disk of the reimaged PC, either include them in the disk image or copy them from c:\windows\temp\psimage, but do not move them as explained in the to_do.bat file.

REM Copy files from psimage folder to their intended locations instead of moving them so they inherit security
REM permission from the existing parent folder. Otherwise the owner will be system account and no users will be able to
REM access the files.
REM
REM If adding registry settings with reg add with a value that includes spaces and double quotes in it, add 
REM outer quotes (to maintain the spaces) and backslash escape the inner quotes to maintain them in the registry
REM value.
REM reg add HKLM\Software\Microsoft\Windows\CurrentVersion\Run /v bginfo /t REG_SZ /d "\"C:\Program Files\bginfo\Bginfo64.exe\" \"C:\Program Files\bginfo\config.bgi\" /timer:0 /silent /nolicprompt"
REM
REM If launching an executable use start /wait so the script waits for your binary to finish before rebooting. 
REM If the commandline includes spaces use start /wait "" <your_command_line>.
REM start /wait "" "c:\windows\temp\psimage\Firefox Setup 88.0.1.exe" /S
REM 
REM For logging redirect the output for your commands with >> c:\windows\temp\psimage.log
REM start /wait "" "c:\windows\temp\psimage\Firefox Setup 88.0.1.exe" /S >> c:\windows\temp\psimage.log
REM
REM To redirect both stderr and stdout for your commands use >> c:\windows\temp\psimage.log 2>&1
REM start /wait "" "c:\windows\temp\psimage\Firefox Setup 88.0.1.exe" /S >> c:\windows\temp\psimage.log 2>&1
REM
REM ========ENTER YOUR POST-IMAGING COMMANDS BELOW========

echo Running to_do.bat >> c:\windows\temp\psimage.log
Deployment and Workflow (PSImage)

Restoring a Disk Image (PSImage)

PSImage is not supported by FileWave Support so please do not submit tickets with them about it. The information provided here is for educational purposes only. If you would like to purchase professional services hours for consulting assistance setting up PSImage or customizing it please contact professional.services@filewave.com with your request. If you have existing unused professional services hours you may be able to use them for this purpose. Any feedback on PSImage can also be sent to the same email address. Any work on this would be done on Discord or in working with Professional Services. For the official Windows Imaging solution please see Network Imaging / IVS.

In general it's recommended that you enable automatic conflict resolution to "Automatically resolve conflicts" with "Replace old client with new" when imaging clients to avoid device conflicts and unnecessary creation of new device client IDs.

  1. Boot from the USB thumb stick or network.
  2. You may be prompted to enter the name of the server hosting the psimage share, name of the share, and credentials depending on how config.ini is set up. If you are reimaging locally you will be presented directly with the main PSImage menu.
  3. At the main PSImage menu select the option to restore a disk image. If mode.reimage file is present, the main PSimage menu will be skipped and you will proceed immediately to restore an image.
  4. If there is an existing image association, the device will proceed directly to restoring a disk image. Otherwise you will be prompted for an image to restore and computername for the client PC. A list of available disk image names will be presented for you to choose from. Copy and paste the desired one at the prompt.
  5. After the client hard disk is wiped and restored, the client PC will reboot to kick off the post-imaging process. You may unplug the USB ethernet adapter as this point if a working Wi-Fi profile is present in the extra folder.
  1. Once the PC reboots and the FileWave client starts up it will connect to the FileWave server and install the "Postimaging - Set Custom Fields" fileset. This fileset will fail for client devices that have been reimaged via fileset as the requirement scripts conditions are not met because custom fields have already been set during the imaging process itself when the To Be Reimaged custom field was flipped back to false (unchecked). It only runs successfully for devices reimaged via USB, PXE, and ISO.

Importing the Imaging filesets and custom field

These items can also be found in the import folder in the psimage share.

  1. Import the "Reimage PC" fileset.
    1. Open its contents and browse to the boot folder.
    2. Add the boot.sdi file from the Boot folder from either the ISO file or USB thumb drive into the boot folder in the fileset.
    3. Add your customized boot.wim file to the same boot folder in the fileset.
    4. Add a copy of bcdedit.exe from the system32 folder of a Windows 10/11 computer into the same boot folder in the fileset. You might have to copy bcdedit.exe to your desktop first before being able to add it to the fileset from there.
  2. Import the "To Be Reimaged" Administrator custom field and assign it to all devices.
    1. Create a smart group with the selection criteria To Be Reimaged - equals - true.
    2. Associate the Reimage PC fileset to this smart group.
  3. Import the "Postimaging - Set Custom Fields" fileset.
    1. View its scripts, right click the set_custom_fields.bat activation script and pick Properties.
    2. Select the Executable tab and then the Environment Variables subtab.
    3. Edit the Value for the the TOKEN variable and replace it with your base64 API token.
    4. Associate this fileset to a smart group that contains all your Windows computers. The fileset has a requirements script that blocks it from installing except on client devices that have just been reimaged.

Restoring a disk image remotely via fileset

In general it's recommended that you enable automatic conflict resolution to "Automatically resolve conflicts" with "Replace old client with new" when imaging clients to avoid unnecessary creation of new device client IDs.

To reimage a client PC remotely, it's recommended you implement the following configuration changes to streamline the disk imaging process to minimize user input on the target computer. For example

With the above settings in place, when a client PC boots from the fileset it will automatically connect to the psimage share and go straight to restoring the pre-assigned disk image.

To reimage a client PC that already has a functional FileWave client on it

  1. Set the To Be Reimaged custom field for that device to true by enabling the checkbox next to it and update model. This will cause it to appear in the smart group to which the imaging fileset has been assigned.
  2. Connect to the remote client PC with TeamViewer if the PC is not next to you and you would like to monitor what's happening. The PC will reboot into Windows PE to reimage.
  3. As soon as the image restoration process starts, the To Be Reimaged custom field for that device will automatically be unchecked/reset back to false, taking it out of the smart group that the reimaging fileset is assigned to so that it does not attempt to reimage again.
  4. If any custom fields are present in image_mappings.txt for this client PC they will be set on the FileWave server.
  5. If there is an existing image association the device will proceed directly to restoring a disk image. Otherwise you will be prompted for an image to restore and computername for the client PC. A list of available disk image names will be presented for you to choose from. Copy and paste the desired one at the prompt.
  6. After the client hard disk is wiped and restored, the client PC will reboot to kick off the post-imaging process. You may unplug the USB ethernet adapter as this point if a working Wi-Fi profile is present in the extra folder.
Deployment and Workflow (PSImage)

Tracking Imaging and Adding Drivers (PSImage)

PSImage is not supported by FileWave Support so please do not submit tickets with them about it. The information provided here is for educational purposes only. If you would like to purchase professional services hours for consulting assistance setting up PSImage or customizing it please contact professional.services@filewave.com with your request. If you have existing unused professional services hours you may be able to use them for this purpose. Any feedback on PSImage can also be sent to the same email address. Any work on this would be done on Discord or in working with Professional Services. For the official Windows Imaging solution please see Network Imaging / IVS.

View imaging history

Browse to the logs folder on the psimage share or the Imaging volume of the USB thumb drive, right-click search_history.ps1, and choose "Run with PowerShell". You may need to expand the window sideways to adequately view the query results. Transcripts of each image restore operation are logged in the \logs\restore folder and named __

Beginning and ending imaging times are written to registry of reimaged client at HKLM\Software\PSImage.  The duration here only includes the post-imaging time. The name of image restored is also written here. Custom field data specified in image_mappings.txt will also be written here if the client device is reimaged using some other methods besides via fileset.

A log of the post-imaging phase is written to c:\windows\temp\psimage.log on the restored client itself. When adding custom post-imaging actions in to_do.bat have their output directed to this psimage.log file for troubleshooting purposes.

Adding drivers to boot.wim

If you find that there is no network access or degraded network access when booted into Windows PE, you may need to inject the appropriate Windows 10 NIC drivers for some of your PC models.

  1. Create c:\windows\temp\driver.
  2. On a working PC of the model you are having an issue with boot into Windows and open a CMD prompt with admin privileges to export all 3rd party drivers. If you have already extracted drivers for this PC model then just check the models folder on your psimage share for the ethernet NIC driver.
    dism /online /export-driver /destination:c:\windows\temp\drivers
    
  3. View c:\windows\temp\drivers or \\psimage\models and check folder names to determine which one holds the ethernet NIC drivers for your PC. Copy the folder containing your ethernet NIC driver to your desktop.
  4. Mount your boot.wim image using the instructions from Building Your Imaging Environment (PSImage).
  5. Inject the drivers for your ethernet NIC with
    dism /image:C:\WinPE_amd64\mount /add-driver /driver:C:\fully\qualified\path\to\driver\folder" /recurse
    
  6. Unmount and commit your changes to boot.wim using the instructions from Building Your Imaging Environment (PSImage).

Custom Behaviors (PSImage)

PSImage is not supported by FileWave Support so please do not submit tickets with them about it. The information provided here is for educational purposes only. If you would like to purchase professional services hours for consulting assistance setting up PSImage or customizing it please contact professional.services@filewave.com with your request. If you have existing unused professional services hours you may be able to use them for this purpose. Any feedback on PSImage can also be sent to the same email address. Any work on this would be done on Discord or in working with Professional Services. For the official Windows Imaging solution please see Network Imaging / IVS.

  1. To prevent client certificate issues when reimaging
    • Do not delete old device entries.
    • Enable "Automatically resolve conflicts - Replace old clients with new" in the New Client From Server window.
  2. If z:\scripts\debug.on exists then restore will drop to command prompt instead of rebooting for reviewing output and troubleshooting. This can be toggled via the the edit_config.ps1 script in the config folder.
  3. If z:\scripts\mode.reimage exists then move straight to imaging and skip PSImage main menu. This can be toggled via the the edit_config.ps1 script in the config folder.
  4. If z:\extra exists contents will be copied to w:\windows\temp\psimage (c:\windows\temp\psimage when new OS boots).
  5. If z:\scripts\to_do.bat exists it will be copied to w:\windows\temp\psimage (or c:\windows\temp\psimage when new OS boots). Will be run during the post-imaging process. A sample to_do.bat is already present by default.
  6. If x:\imaging\config.ini has server=prompt, user will be prompted for server address, rest of creds read from config.ini. For distributed environment where they want to image from local share instead of over WAN.
  7. Set mode=usb in config.ini on boot.wim for dual partition USB disk imaging.
  8. If z:\fwclient\custom exists contents will be copied to C:\Program Files (x86)\FileWave\custom to customize the client kiosk.
  9. Enter z to drop to commandline at
    • The main PSImage menu and
    • When asked to press Return to reboot after successful image capture.
  10. C:\Windows\Temp\restore.done created immediately before last reboot at end of post-imaging phase. Use this file in requirement scripts to postpone filesets until post-imaging is complete.

Troubleshooting (PSImage)

PSImage is not supported by FileWave Support so please do not submit tickets with them about it. The information provided here is for educational purposes only. If you would like to purchase professional services hours for consulting assistance setting up PSImage or customizing it please contact professional.services@filewave.com with your request. If you have existing unused professional services hours you may be able to use them for this purpose. Any feedback on PSImage can also be sent to the same email address. Any work on this would be done on Discord or in working with Professional Services. For the official Windows Imaging solution please see Network Imaging / IVS.

Q: Error copying files from z:\scripts when booting from physical PC. Works fine when booting from VM.

A: Windows PE either 1) does not have the appropriate drivers or  2) non-optimal drivers for the ethernet NIC in this PC. As a result, the network connection is slow to come up and not present when the the imaging attempts to map the psimage share. Inject the the appropriate drivers for the NIC into boot.wim and update it in your USB thumb sticks, WDS server, or fileset. See above section Tracking Imaging and Adding Drivers for details.

Q: Sysprep fails with the following error in setuperr.log - "Audit mode cannot be turned on if reserved storage is in use. An update or servicing operation may be using reserved storage."

A: Open Windows Updates and install all pending OS updates to clear out the reserved storage and re-sysprep again. More info here.

Q: Sysprep fails with the following error in setuperr.log - "Package <PackageFullName> was installed for a user, but not provisioned for all users. This package will not function properly in the sysprep image."

A: Run remove_app.ps1 on client PC from the sysprep folder to remove the offending Microsoft Store app and try sysprepping again. Keep checking the setuperr.log as this can happen with multiple app but sysprep will fail as soon as it runs into the first app it finds with this condition.

Q: Sysprep fails  the following in setuperror.log - "Failure occurred while executing 'CAPISysPrep_Generalize' from C:\Windows\system32\capisp.dll."

A: Trigger sysprep locally from the reference system with the following command.

c:\Windows\System32\Sysprep\sysprep.exe /generalize /oobe /shutdown /unattend:c:\Windows\System32\Sysprep\unattend.xml

Q: Dism fails with an error 2 when restoring a disk image to a PC that has a client mapping in image_mappings.txt.

A: Verify that  the disk image name specified for the device by that serial number exists in the images folder. Edit the mapping entry so that the assigned disk image name matches one of the captured disk images in the images folder.

Q: Post-imaging hangs with repeated message "Waiting 10 seconds for initial inventory to complete" for longer than 5 minutes. 

A: Caused by the client being unable to communicate with the FileWave server, such as when there is a device conflict. Check that "Automatically resolve conflicts" is enabled and set to "Replace old clients with new".