Run USMT as a powershell script for multiple computers at the same time RRS feed

  • General discussion

  • Need to run the scanstate script on multiple computers but create each scanstate folder with the name of each computer.  Is this possible? 

    the example script should look something like this:  \\server\usmt_folder\scanstate.exe \\server\data\%computername% /i:migapp.xml /i:MigUser.xml

    my issue is that the "%computername%" variable does not create the folder base on computername.


    • Changed type Bill_Stewart Wednesday, September 13, 2017 9:24 PM
    • Moved by Bill_Stewart Wednesday, September 13, 2017 9:25 PM This is not support forum for USMT
    Wednesday, July 26, 2017 3:22 AM

All replies

  • PowerShell does not use %<varname>%.  Start by learning PowerShell.

    See the following to set your expectations for this forum: This forum is for scripting questions rather than script requests

    To learn how to use USMT post in the deployment forum: https://social.technet.microsoft.com/Forums/en-US/home?forum=mdt


    Wednesday, July 26, 2017 7:53 AM
  • I was afraid of that.  I know it works perfectly if I place this string in a bat file.  Hoping someone would know a simple way to do this.


    Friday, July 28, 2017 8:18 PM
  • As jrv noted, PowerShell does not use "name surrounded by % characters" to expand environment variable references. Here is the information in PowerShell:

    PS C:\> help environment

    PowerShell's help system is surprisingly helpful. Just type the help command followed by a keyword. In this case, you will see some useful information about how PowerShell uses environment variables.

    -- Bill Stewart [Bill_Stewart]

    Friday, July 28, 2017 8:29 PM