Jump to content


  • 0
Adminoob

QuestionUsing Powershell or VBScript in a Task Sequence to rename computer before domain join - Windows 7

Question

Alright, I had this working fine in MDT, but I am trying a similar approach in SCCM to no avail; I added a package to SCCM with the necessary Powershell script (tested and working) to rename the destination PC with the SMBios computer name (Lenovo computers use the system s/n, which we use to identify them in Active Directory/SCCM). Right before the rename TS I have a command line running the PS comand to set the execution policy to unrestricted. These two TS' I put right after the configure Windows TS, it didn't rename the pc. I moved it to other locations, and cannot get it to work regardless. I figured the trouble might be with UAC, but then every application package I have created thus far works fine during the software install phase, but I tested my script within Windows and found that it worked as expected.

 

A couple points/questions:

 

1. I do NOT want to prompt for a computer name during any stage of the OSD, this must be a fully automated process.

 

2. Is VBScript a better option?

 

3. Should I perhaps try creating an MDT TS in SCCM and then mimic the process that used to work when all I was running was MDT?

 

4. Is there any better method to accomplish this?

 

Thanks!

Share this post


Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0

I figure I'll chime in here since nobody has tossed anything out. Take this with a grain of salt because we use a custom OSD HTA frontend that allows us to select a department and the script then queries SCCM and Active Directory to decide exactly which number to tag onto our naming convention. With that said...

 

You might need to pre-populate the SCCM database with the MAC address and computer name. If you've got an incrementing computer naming convention you could write a VBScript (or whatever your prefered language is) to query the database looking for #1, and if it exists, look for #2, and if it exists, look for #3, and so on until it finds a name NOT in use. HOWEVER, you also need to query against Active Directory because there's the potential to have an SCCM client's account be in AD, but not in SCCM. Then you script could create a record within the SCCM database with that name and the MAC address of the machine being imaged. Then when your OS task sequence runs you don't have to fiddle with renaming...

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.

Guest
Answer this question...

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

Loading...


×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.