Jump to content


h4x0r

Not just another "how do I prompt for computer name" thread ;)

Recommended Posts

We are one child of many in our AD stucure, and there are quite a few others who I know are using SCCM in the same forest, but I dont think many of them use webservices (I may be one of only a few). From what I understand, the web services still function the same with 2012 as they did with 2007, so I'm not too surprised that there isn't much out there in the way of using them with 2012 since it is nearly identical to using them with 2007 (but I could be wrong about this, too!)

 

I'll try to post the code for the custom boot wizard's HTA and such that we use, but it may take me a bit as I'm presently at work and have a couple items that need my attention ;)

Share this post


Link to post
Share on other sites

Sorry for the delay...things got bogged down here and I haven't had the time to get back to you. Here are our modified wizard.hta and ZTIMediaHook.wsf files modified files.zip. Items of note:

 

Wizard.hta -- there are a few sections I added to this file...since if we're using it, then it means that one of our techs is on site to image the computer (otherwise we're just imaging it remotely and not using the boot wizard). The first section that differs from Maik's HTA are a few sub routines that I added to prevent the wizard from being closed and WinPE continuing as normal. Secondly, is a quick password validation field...this just uses a simple encryption function to match the input from the password field (you'll need to run the function in its own script so you can get the encrypted string of your designated password). Without the password, then the end user cannot select a TS from the menu. Ultimately this is not something that I am terribly worried about keeping ultra-secure. If a user REALLY wants to try and hack it, then that's fine...they can image their computer and likely lose all their data in the process...the password verification is really more of an idiot prevention measure.

 

ZTIMediaHook.wsf -- I addded a couple extra web service calls to this...most noteably is the IsComputerKnown call. This runs AFTER the wizard has been processed, but before any checks are made for HasOSDAdvert, simply so that users cannot boot an unknown computer and pull down our image (the wizard requires the password input).

 

We have a single TS for our image deployment (and use the custom boot wizard boot image as the boot image with all deployments), with multiple Apply OS steps being dependant on various TS variables (namely related to which image is to be used). In this scenario, we have this TS being deployed to our Deploy XX OS containers, as well as the Unknown Computers container. On our Unknown Computers container we have have the OSDComputerName variable present but blank. The end result here is that when a known computer boots into the wizard, then we can select whichever deployment we want and continue as normal, and if it is unknown then it kicks out of the wizard and proceeds directly to the normal TS menu. Being unknown, we select the TS that is deployed to the Unknown Computers container, and then proceed to fill in needed variables such as OSDComputerName. The computer gets added to SCCM correctly (thus preventing the bug with the delay of being added via the web service), and is still prompted for a computer name.

 

Hope this helps!

 

modified files.zip

Share this post


Link to post
Share on other sites

This is what I use in my TS right after partitioning.

 


' vbscript
' Declare Variables
Dim strCampus
Dim strSerialNum
Dim strAppend
Dim strComputerName
Dim strLclUser
Dim strLclPW
Dim strComputer
Dim objWMIService
Dim objComputer

' Set Variables
SET env = CreateObject("Microsoft.SMS.TSEnvironment")
strLclUser = "Administrator"
strLclPW = "adminpassword"

'Prompt For Campus
strCampus = INPUTBOX("Enter Campus Name")

'Prompt For Teacher Or Student
strAppend = INPUTBOX("Enter Teacher Or Student")

' Obtain Serial Number
strComputer = "."
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colSMBIOS = objWMIService.ExecQuery("Select * from Win32_BIOS")

For Each objSMBIOS in colSMBIOS
strSerialNum = objSMBIOS.SerialNumber
Next

' Set Computer Name
strComputerName = strCampus & "-" & strSerialNum & "-" & strAppend

'Set OSD Computer Name Variable
env("OSDComputerName") = strComputerName

'End Script

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

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.