Jepeto 46 Posted October 21, 2017 Report post Posted October 21, 2017 I am trying to create a variable which will capture user data to a USB drive. I run the following command line to get the USB drive cmd /c powershell.exe -executionpolicy bypass -command "& {$tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment; $tsenv.Value('USBDrive') = (Get-WMIObject Win32_Volume | ? { $_.Label -eq 'USMT' }).Name}" Dumping the variables, it seems right OSDEnableTCPIPFiltering = falseOSDStateStorePath = USBDrive SMSTSDisableWow64Redirection = false SMSTSLocationMPs = http://ConfigMGR.lab.local SMSTSRebootMessage = SMSTSRebootReason = SMSTSRebootRequested = SMSTSRetryRequested = SMSTSUser = USBDrive = E:\ In the end of the variable dump I see this: SMSTSUserStatePath = C:\_SMSTaskSequence\UserState however when I try to redirect the capture to the %USBDrive% it's not working. Everything works perfect if I hard code it with E: (which I really prefer not to do). The TS order is below Quote Share this post Link to post Share on other sites More sharing options...
Jepeto 46 Posted October 21, 2017 Report post Posted October 21, 2017 I had to change mindset and finally got a standalone media which can capture USMT as well. I had to dump the variables in order to find out I was not in the right path. I ended up creating a new variable (it's all one line) cmd /c powershell.exe -executionpolicy bypass -command "& {$tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment; $tsenv.Value('USBDrive') = (Get-WMIObject Win32_Volume | ? { $_.Label -eq 'CMBOOT' }).Name.substring(0,2)}" After hours of testing I realized that substring(0,2)} is the most important part, it will not capture to E:\ but will to E: Now I could set the OSDStateStorePath variable to %USBDrive% and everything started working. Here is the basic TS Quote Share this post Link to post Share on other sites More sharing options...