Jump to content


ScottP12

OSDComputerName or other variables for setting computer name

Recommended Posts

We are working on deploying Server 2012 R2 via SCCM with Roles being installed based on the computer name.

Our computer naming standards are "location-role-number" where the role is a 2 letter variable like WB for web server.

 

In our task sequence we have added the following condition on the IIS role install...

If ALL conditions are true:

Task Sequence Variable OSDComputerName greater than or equals "%wb%.

 

what we are seeing is that the IIS role will install on any server no matter what the name is. so clearly there's something wrong in the logic of the variable.

 

Any help is greatly appreciated.

 

Scott

Share this post


Link to post
Share on other sites

Thanks. That backs up what I was suspecting.

 

Any other options you can think of for using a variable for the name to install the different roles on different servers?

 

I would like to keep this to just one task sequence if possible and use variables for the different types of server roles that our company uses.

 

Thanks for your help.

Scott

Share this post


Link to post
Share on other sites

Why not use a PowerShell script to check the computer name and install the necessary roles using that? The local computer name can be retrieved using $env:computername and you can install roles and features with something like this:

 

Install-WindowsFeature –Name Web-Server -ComputerName LocalComputerName (this would be your local computer name or PS variable you assigned to the $env:computername)

Share this post


Link to post
Share on other sites

Just set up a collection based on "%wb%" and deploy the PowerShell to that collection - so have a PowerShell script that looks like this:

 

Install-WindowsFeature -Name Web-Server -IncludeAllSubFeature -ComputerName Server1

 

Just add what feature you need and if you don't need all sub features, then don't include the -IncludeAllSubFeature.

 

If you would like more of an explanation let me know in a PM.

  • Like 1

Share this post


Link to post
Share on other sites

Not sure of your Asset design, but you could create collections based on roles... for example you could have collections like so:

  • IIS servers
  • Print servers
  • DHCP servers

and so on.

If your systems are bare metal systems you could use the import computer configuration method and specify which collection to add them to.

 

At the collection level you could create collection variables for example:

  • The IIS server collection have a collection variable like InstallWebServerRole and set to True
  • The Print server collection have a collection variable like InstallPrintManagement and set to true

and so on.

 

Then in your Task sequence create groups and at the root of each group put a task sequence variable to match that of the collection variable.

So for example if you create a group in your TS called deploy IIS role and below this the steps you need to actually configure this role and on the root (the group folder itself) you add a task sequence variable of InstallWebServerRole and set to true also then when you deploy this task sequence out to this collection it will check against the conditions and see that the imported system is indeed a member of IIS servers collection and the conditions set match each other so the IIS role will get installed on this system.

 

 

The beauty about this will be that all the groups (roles to be installed) can be attached to the one TS and the collection and task sequence variables look after what gets installed.

There is of course probably a more automated way of achieving what you are looking for, but if you don't mind importing bare metal systems into the desired collections then this should work a treat and give you the outcome you are looking for.

 

TBH not sure if trying it the Computer Name will actually work as I think that SCCM still thinks that the systems been OSD'd is still the generic name of MININTxxxxx right up until the end of the deployment, by which at this time in the deployment it is too late!

This is of course in bare metal deployments anyway!

Share this post


Link to post
Share on other sites

Thanks for the replies.

 

We ended up going with a the following WMI Query to get the computer name.

 

SELECT * from win32_ComputerSystem where Name like "%WB%"

 

Once we added this to the options for the item it works as expected.

 

Scott

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.