Help with Powershell Script to Automate USMT


  • Hello,

    I'm currently trying to streamline USMT with the use PowerShell. I unfortunately cannot use MDT, WDS. or SCCM. I'm have a PowerShell script I worked on, but am in need of figuring out what I am missing to make it work. Hoping someone can help me get over that little bit.

    As the script stands now, I am getting an error shortly after I enter the Username of the person I want to have copied over. The way I have the script setup is to take parameters and insert those parameters into the arguments so I don't have to edit a .bat file for each new machine. I just want to be able to run this .ps1 from the Source machine and have it prompt me for variables. I want to run the equivalent using loadstate, which I will build as soon as I can figure out the scanstate.

    $Credentials = Get-Credential -Credential SmartDeployTest\
    $InvokingUser = $Credentials.UserName
    $ElevatedPassword = $Credentials.GetNetworkCredential().Password
    $SourcePCName = Read-Host -Prompt "Enter hostname of source PC"
    $CapturedUser = Read-Host -Prompt "Enter the username for the profile you want to capture"
    # must check for valid values
    $sb = {
    	$scanstate = '\\smartdeploytest\USMT\amd64\scanstate.exe'
    	$arglist = @(
    	$process = Start-Process -FilePath $scanstate -ArgumentList $arglist -Wait -PassThru
    	# check process status
    Invoke-Command $sb -ComputerName $SourcePCName -ArgumentList $SourcePCName,$CapturedUser
    Read-Host -Prompt "USMT-SAVESTATE Process has completed! Check USMT logs for details. (Press Enter to exit)"

    mercredi 15 mars 2017 19:58

Toutes les réponses

  • Hi,

    From these error prompts to see, winrm configuration has to be checked on target computer.

    Please try this command to see if it helps:

    winrm set winrm/config/client @{TrustedHosts="RemoteComputerName"}

    Best regards,


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact

    jeudi 16 mars 2017 09:19
  • Hi Kallb

    We have the same issue not using SCCM but we resorted to use User Profile Central - UPC from EhlerTech

     - The real beauty is that UPC does NOT use Powershell as we do not allow remote PS.

    1. UPC detects the users and list them,
    2. Runs USMT for you at the remote PC's
    3. and store the backups at/restore from/ a network share. 

    It even runs smoothly while the user is logged on. 

    UPC is REALLY simple to use and in the latest 1803 version comes with Customized XML files and even a fix for migration of Modern Apps like Sticky Notes and Edge Favorites.


    mardi 8 mai 2018 12:00