Install Windows Updates Task Sequence 0X80004005
Install User targeted Applications during OS Deployment via Power. Dentofacial Planner Software Program'>Dentofacial Planner Software Program. Shell and Config. Mgr 2. 01. 2 More than just Config. Mgr. Lets start my first post of this great new year with another nice Power. Shell script. This post will be about deploying required user targeted applications, to the device of the primary user, during OS deployment. Yes, I know the setting of Pre deploy software to the users primary device, but that doesnt give enough control. After deployment, the device has to be completely ready for use. Gi-yBQM4w/WK9bw6neWII/AAAAAAAABwA/JJhaI6KmnykD13b9EzX1Sh7s1lq8FYf4wCLcB/s1600/SCCM%2BIn-Place%2BUpgrade%2BTS-8.PNG' alt='Install Windows Updates Task Sequence 0X80004005' title='Install Windows Updates Task Sequence 0X80004005' />In this post we will see the steps for deploying windows 7 using SCCM 2012 R2,deploying the captured image using SCCM 2012 R2,SCCM 2012 R2. Install Windows Updates Task Sequence 0x80004005 Sccm' title='Install Windows Updates Task Sequence 0x80004005 Sccm' />A bit more than a year ago I already did a post about pre provisioning user applications during OS deployment via Orchestrator and Config. Mgr 2. 01. 2. This time I wanted to make less assumptions. I also wanted to be sure that a user is a member of a collection and what the application is that is deployed to the collection. I first tried to achieve this goal by adjusting my runbook in Orchestrator and I made it work and it still works, but to make it work I had to use all custom Power. Shell activities. This made me think why I still wanted this and I couldnt come up with something better than because I can. Install Windows Updates Task Sequence 0x800040050x000b220x000501Error Identifier Description Code Severity Facility Code ERRORSUCCESS 0x0 The operation completed successfully. ERRORINVALIDFUNCTION 0x1 Incorrect. So I decided to make one Power. Shell script to find the applications and to create the task sequence variables. Script. The main part of this script is gathering data and filtering it. In short I could say this script consists of five queries and an action. The following six steps make sure that I only get the applications, that are required for the primary user of the device, to be installed during the OS deployment. Step 1 Get the Primary User. Flamingo Barnes 2 Mingo Royale. The first step is to get the primary user of the device thats being deployed. That information can be retrieved in WMI in the class SMSUser. Machine. Relationship. This class shows the relationship of a user with a device, even when its only a suggestion yet. The properties of Sources and Types can be used to see how the primary user is defined and to see if its a suggestion or a real affinity. I know that, in my case, all the device affinities are administrator defined. So to get the user name of the primary user of a device I use the following code snippet format is lt Domain lt User Primary. User Get Wmi. Object Computer. Name Site. Server. Class SMSUser. Machine. Relationship. Namespace rootSMSSiteSite. Code. FilterResource. NameResource. Name. Unique. User. Name. Step 2 Get the Container Node. The second step is to get the container node of the application deployment collections. This will be used to make sure that only collections used for application deployments will be queried. This information can be retrieved in WMI in the class SMSObject. Container. Node. This class shows the different folders in the console and its location. The property Object. Type. Name can be used to see the type of objects in the folder. In my case, I occasionally use identical folder names. So to get the container node information that I need, I use the following code snippet Container. Node. Id Get Wmi. Object Computer. Name Site. Server. Class SMSObject. Container. Node. Namespace rootSMSsiteSite. Code. FilterNameContainer and. Object. Type. NameSMSCollectionUser. Container. Node. Id. Step 3 Get the Collections. The third step is to get the collections within the container. This information can be retrieved in WMI in the class SMSObject. Container. Item. This class shows the relation between an container and the objects within an container. So to get the collections within the container I use the following code snippet Instance. Keys Get Wmi. Object Computer. Name Site. Server. Class SMSObject. Container. Item. Namespace rootSMSsiteSite. Code. FilterContainer. Node. IDContainer. Node. Id. Instance. Key. Step 4 Filter the Collections. The fourth step is to filter the collections on a specific collection member. This will make sure that only collections used for application deployments AND with the specific collection member will be queried later on. This information can be found in WMI in the class SMSFull. Collection. Membership. This class shows the different collection members and their memberships. The best thing, the property SMSID shows the collection member in exactly exactly the same format as I have the primary user of the device. So to filter the collections I use the following code snippet Collection. Id Get Wmi. Object Computer. Name Site. Server. Class SMSFull. Collection. Membership. Namespace rootSMSsiteSite. Code. Where Object. Collection. ID eqInstance. Key and. SMSID eqPrimary. User. Collection. Id. Note For an unknown reason, to me, a normal filter did not work together with the property SMSID. Thats why I had to use an where object statement. Step 5 Get the targeted Applications. The fifth step is to get the applications that are targeted to the filtered collection. This makes sure that only applications deployed to collections, of which the primary user of the device is a member, will be filtered. This information can be found in WMI in the class SMSApplication. Assignment. The property Offer. Type. ID can be used to see if the deployment is required or available. I only want to have the required applications. So this makes that I use the following code snippet Application. Names Get Wmi. Object Computer. Name Site. Server. Class SMSApplication. Assignment. Namespace rootSMSsiteSite. Code. FilterTarget. Collection. IDCollection. Id and. Offer. Type. ID0. Application. Name. Step 6 Create the Task Sequence Variables. The sixth, and last step, is to create task sequence variables for the applications that have to be installed during the OS deployment. For every application I create a task sequence variable named APPId. XX with the value of the application. To achieve this I use the following code snippet foreach Application. NameinApplication. Names. Id0 D2 fCountApp. IdAPPIdIdTSEnv. ValueApp. Id Application. NameCountCount1. Note In the complete script I already created a variable Count with the value 0 and an object named TSEnv of Microsoft. SMS. TSEnvironment. The complete script is available via download here on the Tech. Net Galleries lt lt Usage. Now download the Power. Shell script via the link above and add the Power. Shell script to an old school Package, so it will be available for a task sequence. Then create a standard Install an existing image package task sequence. Now edit the task sequence and make sure the following steps are included Note The computer account running the script needs read access to Config. Mgr. So in most cases this would mean that the Domain Computers need read access to Config. Mgr. This can be achieved via the build in role of Read only Analyst.