Jump to content


SCCM OSD Generate PC name based domain username...

Recommended Posts

Hi Guys,


I'm new on SCCM so I'm coming from MDT 2013 which by the way is working great for me, but I'll like to take the deployment to the next level and build some “OSD frontend” to allow me create my custom deployment. So let me explain a litter what I'm wanted to do. On SCCM 2012 R2, I do have a basic W10 deployment working, I mean, PC is in our domain and other basic stuff, but I just looking to add some cool features like auto PC rename base of user domain, so I have a script on the deployment process (SCCM Task Sequence) which ask me an user name, then I'll like to uses that TS store variable, call it from a PowerShell script and get the username from AD using a remote session, then from there get the department name variable and at the end depend of the user Department get the PC rename and also pre-provision user applications, based on group membership during the deployment process, that way the user doesn't have to way for a login process to get the applications from the SCCM server. I'm currently stopped on the script after the username variable, I don't know how to make it work with the AD and the department. Can you please have some idea that make can help me to continue with my project. I'll appreciate that.


Example of PC name:


Domain (MS) + Type (L or W) + Department (IT) + consecutive number from AD (001) = MSWIT001


The Script I have so far...


#Close the TS UI temporarily
$TSProgressUI = New-Object -COMObject Microsoft.SMS.TSProgressUI

#Prompt for input
[system.Reflection.Assembly]::LoadWithPartialName('Microsoft.VisualBasic') | Out-Null
$TSUsername = [Microsoft.VisualBasic.Interaction]::InputBox("Enter the Domain Username for this deployment", "AD Domain User", "e.g. tlee")

#Set the TS variable
$tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment
$tsenv.Value("TSUsername") = $TSUsername


Thank you in advance,



Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...