ScottP12 Posted April 15, 2014 Report post Posted April 15, 2014 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 Quote Share this post Link to post Share on other sites More sharing options...
Kazi Posted April 15, 2014 Report post Posted April 15, 2014 I don't believe that a task sequence will support a partially matching variable. In order to use '%wb%", the condition would have to be Variable OSDComputerName like "%wb%" which doesn't exist in TS. Quote Share this post Link to post Share on other sites More sharing options...
ScottP12 Posted April 15, 2014 Report post Posted April 15, 2014 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 Quote Share this post Link to post Share on other sites More sharing options...
Kazi Posted April 15, 2014 Report post Posted April 15, 2014 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) Quote Share this post Link to post Share on other sites More sharing options...
ScottP12 Posted April 17, 2014 Report post Posted April 17, 2014 Thanks for the suggestion. Now to try to find someone on my team who knows PowerShell. I'm a bit of a noob when it comes to scripting. Quote Share this post Link to post Share on other sites More sharing options...
Kazi Posted April 17, 2014 Report post Posted April 17, 2014 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. 1 Quote Share this post Link to post Share on other sites More sharing options...
Rocket Man Posted April 18, 2014 Report post Posted April 18, 2014 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! Quote Share this post Link to post Share on other sites More sharing options...
ScottP12 Posted April 18, 2014 Report post Posted April 18, 2014 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 Quote Share this post Link to post Share on other sites More sharing options...