I was able to solve by excluding the serviceui.exe, the command line looks like:
powershell.exe -executionpolicy bypass -windowstyle hidden -file "%SCRIPTROOT%\<My-Script>.ps1"
Prompt for Computer Name during OSD with PowerShell (MDT)
Dear all,
I trying to add a prompt for a OSDComputername during the deployment but I'm not able to get it to work. For reference I found the following blogposts:
https://social.technet.microsoft.com/Forums/en-US/e7abd31b-2b13-4f43-bccf-92bab543c4d9/prompt-for-osdcomputername
https://msendpointmgr.com/2013/10/02/prompt-for-computer-name-during-osd-with-powershell/
Problem is that it looks like SCCM (according to the attached picture). IN the picture it looks like they have added both the command line and the application, but I'm using MDT.
I tried to add a Command Line with the following code: ServiceUI.exe -process:TSProgressUI.exe %SYSTEMROOT%\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -WindowStyle Hidden -ExecutionPolicy Bypass -File Set-OSDComputerNamePrompt.ps1
I also tried to create an application and specified the source folder which contains the serviceUI.exe (64bit) and the OSDCOmputerComputerNamePrompt.ps1 with the previous command line but it always fails me with the deployment.
Where do I need to place Set-OSDComputerNamePrompt.ps1 , in my scripts folder under the DeploymentShare$/Scripts or how does the command find the .ps1 ?
Thank you
Best Regards
4 answers
Sort by: Most helpful
-
lupinlicious 136 Reputation points
2021-12-31T11:13:44.81+00:00 -
Pavel yannara Mirochnitchenko 12,606 Reputation points MVP
2021-12-29T16:06:12.717+00:00 The are many methods how to archive this, I also know;
- use osd computer variable in the collection you target TS
- use OSDcomputername vbs script (old but works)
- use MDT UDI to cover this (I mostly recommend this one if you want to enlarge your OSD solution)
- use OSDcomputername with LAPTOP-%serialnumber%
If I would be you, I would drop this PS1 script and go with some of these well proven solutions. You also might have some typo or wrong logic in that command line you use, but I cannot help you with that now.
-
Amandayou-MSFT 11,141 Reputation points
2022-01-07T06:31:04.673+00:00 Hi @lupinlicious ,
Thank you very much for your feedback and sharing. We're glad that the question is solved now. I think maybe other peoples with the same needs will benefit from it. Here's a short summary for the problem.
Problem/Symptom:
Add a Command Line with the following code but fails:
ServiceUI.exe -process:TSProgressUI.exe %SYSTEMROOT%\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -WindowStyle Hidden -ExecutionPolicy Bypass -File Set-OSDComputerNamePrompt.ps1Solution:
the command line looks like:
powershell.exe -executionpolicy bypass -windowstyle hidden -file "%SCRIPTROOT%\<My-Script>.ps1"Please click "Accept Answer" to your answer and upvote it, this will help other users to search for useful information more quickly. Thanks again for your time.
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread. -
Amandayou-MSFT 11,141 Reputation points
2021-12-30T09:09:15.983+00:00 Hi,
Haven't heard from you for some time, is yannara 's answer helpful to you? If it is helpful, please accept answer. It will make someone who has the similar issue easily find the answer.
If you have any other issues, please don't hesitate to let us know.
Thanks and have a nice day.
Best regards,
Amanda