Monday, February 9, 2015

Distributing and Deploying an Application in SCCM 2012 R2 with Powershell

     So it's been a little while since I blogged.  Its been a busy winter and not much happened in my world regarding automation and powershell.

I finally got some time, while waiting for our new surveillance DVRs to arrive, to work on using Powershell with SCCM.  We have our computer labs in their own collections and deploy much of the same software to them.  The main issue we run into is determining how many computers in each lab got the deployed software application.  Yes, I know there are reports that I can run.  The SCCM server I inherited didn't have it installed and I had to get it set up.  I also know that it is working and use the reports quite frequently.  The issue we were having is that we wanted a 5 second look instead of a 5 minute.  The reporting is good, just not quick enough for me or any of my team members.

That's my reason, whether its good or not.  Here we go!

One part of this process I don't have is creating the Application from Powershell.  I still do this manually.  Hopefully, a future post will cover this.

Now I have an Application I have created.  The first step from this point is to distribute the content.  The first thing I did was go to the Technet site for the Start-CMContentDistribution cmdlet.

The command I used was:
 Start-CMContentDistribution -ApplicationName "Adobe Flash Player 16.0.0.305" -DistributionPointName "SCCM.EKHOFF>US" -DistributionPointGroup "HEADQUARTERS"  

I initially had trouble with this command.  I was using -CollectionName along with the Distribution Point parameters.  Turns out I didn't need it. I did have to create a Distribution Point Group and add our single server to it.

After checking the Content Status and verifying it was distributed I was ready to deploy to my collections.  I had forgotten about the distribution step but I received an error when I tried to deploy my first Application.

Again I went to Technet to Start-CMApplicationDeployment

The command I settled on was:

 Start-CMApplicationDeployment -CollectionName "Tech Test" -Name $AppName -AvaliableDate $Date -AvaliableTime $Time -DeployAction Install -DeployPurpose Required -UserNotification DisplaySoftwareCenterOnly -OverrideServiceWindow $true -RebootOutsideServiceWindow $false  

With all the options I wasn't sure where to start.  I ended up going through the deployment manually to see what I actually changed and set.  From there I had a pretty good I idea of what I was looking for.  After successfully deploying to one collection I knew I need this to scale to all labs.

I created a menu to deploy to the most common situations.  Right now we'll look at number 1.

 1. Deploy to All Labs"
 2. Deploy to All Netbooks"
 3. Deploy to Teachers and Staff"
 4. Deploy to Tech Test"

My first thought was to  just have a separate Start-CMApplicationDeployment for each lab.  After looking at the script and the length I decided I needed to make the code cleaner and easier to update.  We have around 40 netbook carts which would have made this code extremely long.

1:  $labArray = @("C107", "C109", "C111", "W208", "W210", "W212", "W216", "W229", "EE154", "EE156", "PCLAB", "StudyHall")  
2:  #All Labs selection  
3:  If($menu -eq 1){  
4:    foreach ($element in $labArray) {  
5:    Start-CMApplicationDeployment -CollectionName $element -Name $AppName -AvaliableDate $Date -AvaliableTime $Time -DeployAction Install -DeployPurpose Required -UserNotification DisplaySoftwareCenterOnly -OverrideServiceWindow $true -RebootOutsideServiceWindow $false  
6:    }  
7:  }  

2 comments:

  1. Awesome article about distributing and deploying applications. Thanks for share your useful post.
    My Page

    ReplyDelete
  2. This platform additionally provides over 200 video games, supplied by Realtime Gaming and Visionary iGaming. Once you’ve found the proper live on line casino, create an account. This course of is often pretty easy and only requires a number of} pieces of private data . Most live casinos ask users to send a replica of either their passport or ID to show their identity. Because the chances are greater in European 코인카지노 roulette, you must to} always play it somewhat than American roulette.

    ReplyDelete