none
CM 2012 SP1 | How to find out the name of an existing Deployment Type?

    Question

  • Im trying to use the Set-CMDeploymentType cmdlet to edit a deployment type but run into some problems when I try to specify -DeploymentTypeName. I always know the exact application name, but not the name of the deployment type. Is there a good and easy way to determine an application's deployment type name?

    TWP

    Wednesday, June 19, 2013 5:15 PM

Answers

All replies

  • How about Get-CMDeploymentType: http://technet.microsoft.com/en-us/library/jj850086.aspx?

    Jason | http://blog.configmgrftw.com

    Wednesday, June 19, 2013 5:44 PM
    Moderator
  • Yes, As Jason said

    Get-CMDeploymentType by specifying ApplicationName will return list of all DTs present in that application.

    Syntax:: Get-CMDeploymentType -ApplicationName <String>

    Thanks

    Sreekar Mankala

    Wednesday, June 19, 2013 8:38 PM
  • Thats great but Im not intrested in a list. I just need the name of the deplyment type so I can put it in a variable and use in my script. I need it so I can use it in Set-CMDeploymentType.

    TWP

    Wednesday, June 19, 2013 9:31 PM
  • Sorry, but huh? That will output all of the deployment types for a specific deployment from which you can either retype or cope and paste the deployment type name for your command.

    Not sure why that's unusable?


    Jason | http://blog.configmgrftw.com

    Wednesday, June 19, 2013 9:50 PM
    Moderator
  • Sorry, but huh? That will output all of the deployment types for a specific deployment from which you can either retype or cope and paste the deployment type name for your command.

    Not sure why that's unusable?


    Jason | http://blog.configmgrftw.com

    I want to automate the process and use it in a script so copy & paste is not what im looking for. This is just a small piece of a bigger script but for everything to work I need to learn how to find the deloyment type name of the application Im trying to create/edit. If I just wanted to know the name of one deployment type for one applicatione then I would use the console and not powershell:)

    TWP

    Wednesday, June 19, 2013 10:25 PM
  • Ok, so, everything in PowerShell is an object. Just set value of a variable to the output of Get-CMDeploymentType and then iterate over the objects stored in that variable passing them to Set-CMDeploymentType.

    Jason | http://blog.configmgrftw.com

    Wednesday, June 19, 2013 10:36 PM
    Moderator
  • Ok, so, everything in PowerShell is an object. Just set value of a variable to the output of Get-CMDeploymentType and then iterate over the objects stored in that variable passing them to Set-CMDeploymentType.

    Jason | http://blog.configmgrftw.com

    Can you please give me an example of how to do that so I just get the name och the deployment type and not all the objects? I need an example that gives me an output of just the deployment type name and nothing else.

    TWP

    Wednesday, June 19, 2013 10:48 PM
  • $DTs = Get-CMDeploymentType -ApplicationName "Your_Application_Name"
    foreach($DT in $DTs)
    {
        $DT.LocalizedDisplayName
    }

    Torsten Meringer | http://www.mssccmfaq.de

    • Marked as answer by TWP11 Thursday, June 20, 2013 8:04 AM
    Thursday, June 20, 2013 7:07 AM
  • $DTs = Get-CMDeploymentType -ApplicationName "Your_Application_Name"
    foreach($DT in $DTs)
    {
        $DT.LocalizedDisplayName
    }

    Torsten Meringer | http://www.mssccmfaq.de


    It was exactly what I needed :) Thank you very much!

    TWP

    Thursday, June 20, 2013 8:04 AM
  • Pay attention though. Sometimes you need to add a ".toString()" after "LocalizedDisplayName". cmdlets, for some reason, don't always return them...
    Thursday, June 20, 2013 8:24 AM
  • Pay attention though. Sometimes you need to add a ".toString()" after "LocalizedDisplayName". cmdlets, for some reason, don't always return them...

    Are you suggesting that I should always have it there? How else will I know when it is needed?

    Like this?

    $DTs = Get-CMDeploymentType -ApplicationName "Your_Application_Name"
    foreach($DT in $DTs)
    {
        $DT.LocalizedDisplayName.toString()
    }


    TWP

    Thursday, June 20, 2013 8:31 AM
  • Yup, like this.

    I'd recommend to always use it. Sometimes it will work w/o it, sometimes it won't. How'd you realize it? The cmdlet'd throw an error that says something about wrong input object.

    Thursday, June 20, 2013 12:28 PM
  • Yup, like this.

    I'd recommend to always use it. Sometimes it will work w/o it, sometimes it won't. How'd you realize it? The cmdlet'd throw an error that says something about wrong input object.


    I will try to use it like this:
        New-CMApplication -Name $AppName -AutoInstall $True -Manufacturer $VendorName -SoftwareVersion $SoftVer
        Add-CMDeploymentType -ApplicationName $AppName -AutoIdentifyFromInstallationFile -ForceForUnknownPublisher $True -InstallationFileLocation $InstFileLocation -MsiInstaller -InstallationBehaviorType InstallForSystem
        
        $DTs = Get-CMDeploymentType -ApplicationName $AppName
        foreach($DT in $DTs)
        {
            $DepTypeName = $DT.LocalizedDisplayName.toString()
        }
        Set-CMDeploymentType -ApplicationName $AppName -DeploymentTypeName $DepTypeName -MsiOrScriptInstaller -EstimatedInstallationTimeMinutes $EstimInstallTime -InstallationBehaviorType InstallForSystem -InstallationProgramVisibility Hidden -LogonRequirementType WhereOrNotUserLoggedOn -MaximumAllowedRunTimeMinutes $MaxRunTime -InstallationProgram $InstallCom -UninstallProgram $UninstallCom
    Yes, I have seen the error and don't know why!? But it still gets the DepTypeName correct.
    After the example above I will deploy it:
        Start-CMContentDistribution -ApplicationName $AppName -DistributionPointGroupName $DPGroup
        Start-CMApplicationDeployment -CollectionName $ColName -Name $AppName -DeployAction Install -DeployPurpose Required -UserNotification HideAll
    Im running the code from a GUI that I use to create collections, ad-groups and querys.

    TWP

    Thursday, June 20, 2013 1:26 PM
  • Everything looks fine now when i look in the console. All settings are right in Application, Deploymnet type, and Deployment and everything is distributed.

    Despite this, I still have two issues:
    1. Although the deployment type looks right, Applications will not install. There are no errors in the reports either. Suspect that something goes wrong when deployment type is created. The only difference I can see is that the deployment type name when it is created with the script is "7-Zip 9.20" and when it is created manually "7-Zip 9.20 - Windows Installer (*. Msi files)." Besides that everything looks exactly the same. When I create deployment type manually application is installed without any problems.

    2. Start CMApplicationDeployment takes a very long time to run. Up to 5 min.


    TWP


    • Edited by TWP11 Thursday, June 20, 2013 1:44 PM Nube
    Thursday, June 20, 2013 1:43 PM
  • This last post really should be a new thread as it has nothing to do with the original question. To troubleshoot an app deployment, you need to look at the client side app logs: appintenteval, appdiscovery, and appenforce.

    Also, for using the ToString(), it is not really something you should use. As mention above cmdlets, all cmdlets in PowerShell return objects. When using various properties of those objects, you need to cognizant of the property type of the specific property that you are working with. For the localizeddisplayname, it's a string already so there's no need to do anything. ToString can come in handy if you are perofrming an operation that expects an object but you want to pass it a string instead (which is actually just another form of an object). To sum it up, using it is rarely (if ever) actually required. 


    Jason | http://blog.configmgrftw.com

    Friday, June 21, 2013 3:05 AM
    Moderator
  • You're right. 
    However, I have run into issues in the past not adding .toString() - strangely this is concerning cmdlets only and not wmi...
    My usual approach is a quick getType() and or get-member to determine what I can do with whatever is returned to me. But yeah I shouldn't have generalized it like that.

    Friday, June 21, 2013 11:58 AM