Jump to content


h4x0r

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

Recommended Posts

This is mostly for people familiar with MDT scripting/integration...

 

I've been working on this non-stop today trying all sorts of methods to try and accomplish a prompt for computer name at a specific point...I'm certain that it can be done, but I'm losing hope! :P

 

Here's the scenario...I'm using Maik Koster's web service (v7.3), as well as his custom boot image for OSD, with MDT 2012 integration. With the custom boot image, the pre-execution mediahook runs and performs a series of webservice calls to populate a wizard that allows for TS selection. After the selection is made, it adds the computer to the appropriate collection with the OSD TS and off you go! This works GREAT for known computers...unknown computers are a little different. I can boot unknown computers to the custom boot wizard, and they get added to whichever collection and are added to the server at the same time. HERE IS THE ODDITY: the computers get added with their MAC address as the computer name, as opposed to MININT-######

 

I've added a successful check in the pre-execution hook to test if the computer is known or not...if it is unknown, then a simple prompt comes up and we can put in the computer name. THE PROBLEM is that I have NO IDEA what variable I'm supposed to set with the input. The pre-execution hook calls ZTIGather and ZTIUtlity...I've tried setting oEnvironment.Item("OSDComputerName")/("HostName") to the input gathered previously...but it didn't change anything (the webservice call is SUPPOSED to use OSDComputerName as the name)...I'm honestly stumped as to what variable I need to set (since it is using the MAC address for the name), OR would be more viable to try and set a (environmental?) variable that the SCCM_Bootstrap.ini/Customsettings.ini uses? For instance the existing webservice call in the ini file looks like this:

 

-----------------------------------------

 

[AddComputerToCollection]

WebService=http://YourWebServer/Deployment/SCCM.asmx/AddComputerToCollection

Parameters=MACAddress,UUID,CollectionID,ComputerName

MACAddress=macAddress

UUID=UUID

CollectionID=collectionID

ComputerName=Computername <-- THIS IS NOT POPULATED FOR SOME REASON

------------------------------------------

 

would it be possible to do something such as:

 

-------------------------------------------

MyNewCustomVariable=%SetByScript%

 

 

[AddComputerToCollection]

WebService=http://YourWebServer/Deployment/SCCM.asmx/AddComputerToCollection

Parameters=MACAddress,UUID,CollectionID,ComputerName

MACAddress=macAddress

UUID=UUID

CollectionID=collectionID

MyNewCustomVariable=Computername

 

--------------------------------------------

 

I guess that it might be possible that SCCM is inserting the MAC address to use as the computer name since/if it isn't being provided...but that thought just occurred to me, and I haven't had a chance to look into that possibility. This is all very new to me, as I'm not super familiar with the workings of MDT scripting/customizations. When I get back to work in the morning, I'm going to go through the logs again and see if/where I missed the section that is using the MAC address for the computer name.

 

Hopefully, if I can get this working, then I'll have a very handy method for imaging bare metal workstations with a computer name prompt tied in :)

Share this post


Link to post
Share on other sites

shouldn't it be OSDComputerName,

checkout my example of doing just this here

 

How can I easily prompt for a computer name in Configuration Manager 2012

Prompting for a computer name using the OSDComputerName variable [May 11th, 2012].

Share this post


Link to post
Share on other sites

It SHOULD be (as a side note, that's what we use to prompt for a name while we don't have the boot wizard up and running fully yet), but I think one of the caveats is that due to the nature of the pre-execution hook, that OSDComputerName variable on the Unknown Computers collection is never created since the webservice ends up creating a DDR for the computer and adding it to the collection selected. I guess a possible way around that would be to duplicate all my OSD collections and simply have a set for unknown computers with the OSDComputerName set...but that wouldn't be as streamlined as I would like :P

 

I'm going to have a look now at the logs, and also play around with how I can set variables for use with the customsettings.ini to see if that has any effect.

Share this post


Link to post
Share on other sites

If you want to use the MAC Address as the computer name you could use this line in the default section of your customsettings.ini file.

You could also tweak this a little bit more by replacing the PC prefix for Laptops.

 

OSDComputerName=PC#Replace("%MacAddress001%",":","")#

Share this post


Link to post
Share on other sites

Unfortunately, workstation names go by specific locations and room numbers...so using the MAC address is out of the question.

 

As of right now, I believe that it was SCCM using the MAC address as the computer name when the DDR was getting created by the webservice, since a name wasn't being provided.

Share this post


Link to post
Share on other sites

Have some issues with Maik's web service as well. OSDComputerName is not carried through the rest of the TS and is not applied. I'm using his PrettyGoodFrontendClone. Also, if the computer is unknown to SCCM and then added to an OSD collection, it waits for all 25 tries under the HasOSAdvertisement step outlined in the CustomSettings.ini file. After a few minutes it shows up in the correct collection when I look in the console. But it obviously takes too long.

 

We use this exact web service and frontend in our current SCCM 2007 production environment. But in the 2012 lab environment it just won't work.

 

Any ideas?

Share this post


Link to post
Share on other sites

There apparently is some sort of bug with his webservice where adding an unknown computer will create an entry for it, but it doesn't get "completely" added to SCCM for a few minutes...thus it sits through the number of cycles waiting for HasOSAdvertisement. We don't use the PrettyGoodFrontendCline...we just use the custom boot wizard. What I ended up doing was modifying part of the HTA wizard in a couple ways. One was to add a bit of user security and so I have a password field set, which if entered incorrectly after three tries will simply reboot the computer, or if the wizard is canceled it will also reboot. The second is to run another webservice call for IsComputerKnown, and if it returns false then I stop the script from continuing and it then dumps the computer right into the standard TS GUI. From there I select our deploy OS TS, and because it is deployed to the Unknown Computers collection, we have to set the OSDComputerName variable...so that's when it gets prompted for the name, AND gets added to SCCM correctly.

 

Unfortunately I just wasn't able to find a smoother way of adding unknown computers simply using Maik's webservice.

Share this post


Link to post
Share on other sites

Thanks for the info! Are admins/MVPs running SCCM 2012 just not using web services? Can't seem to find any information about this on the internet when it comes to 2012. Plenty of info for 2007 but that doesn't really help in this case.

 

I would really appreciate if you could paste the code from your customizations, if that would be alright?

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.