Prompt for Computer Name during OSD with PowerShell (MDT)

lupinlicious 136 Reputation points
2021-12-29T08:53:17.867+00:00

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.

161096-osdcomputername.png

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

Microsoft Deployment Toolkit
Microsoft Deployment Toolkit
A collection of Microsoft tools and documentation for automating desktop and server deployment. Previously known as Microsoft Solution Accelerator for Business Desktop Deployment (BDD).
902 questions
0 comments No comments
{count} votes

4 answers

Sort by: Most helpful
  1. lupinlicious 136 Reputation points
    2021-12-31T11:13:44.81+00:00

    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"

    3 people found this answer helpful.

  2. Pavel yannara Mirochnitchenko 12,596 Reputation points MVP
    2021-12-29T16:06:12.717+00:00

    The are many methods how to archive this, I also know;

    1. use osd computer variable in the collection you target TS
    2. use OSDcomputername vbs script (old but works)
    3. use MDT UDI to cover this (I mostly recommend this one if you want to enlarge your OSD solution)
    4. 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.

    1 person found this answer helpful.
    0 comments No comments

  3. 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.ps1

    Solution:
    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.

    1 person found this answer helpful.

  4. 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

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.