none
Assign applications to MakeModel via Powershell RRS feed

  • Question

  • I am attempting to script adding Multiple make an models via PowerShell.  I need to know if I can add a LTI application to the makemodel ID via PowerShell assuming I have the application's GUID.
    Wednesday, August 27, 2014 8:00 PM

Answers

  • Oh, you are using Mike Niehaus's MDT Database add-on pack, and you want to associate Makes and Models to the database using Powershell against the *DATABASE* not use Powershell on the Client.

    Sure, how about this:

    import-module .\MDTDB.psm1 
    connect-mdtdatabase -sqlserver $Server -instance SQLEXPRESS -database MDTDatabase 
    import-csv .\Models.csv | New-MDTMakeModel -settings @{Applications001='GUID_HERE'}


    Keith Garner - Principal Consultant [owner] - http://DeploymentLive.com


    Thursday, August 28, 2014 6:28 PM
    Moderator
  • OK I just read the article, and it appears that Applications have a slightly different syntax. Check the article for usage

    Keith Garner - Principal Consultant [owner] - http://DeploymentLive.com

    • Marked as answer by Keith Templin Friday, August 29, 2014 12:54 AM
    Thursday, August 28, 2014 11:36 PM
    Moderator

All replies

  • You will need a table of Make/Models along with the associated application in MDT.

    Once you have done the correct look up, then call ZTIApplications.wsf with your Application.

    Two options:

    1. Create a step in the task sequence to call your application (single), and create a WMI condition on the step to only run if the MAke/Model conditions are true.

    2. Create a script to perform the lookup and call the correct GUID using
    cscript.exe %SCriptRoot%\ZTIApplicaitons.wsf /ApplicationGUID:<guid>


    Keith Garner - Principal Consultant [owner] - http://DeploymentLive.com

    Thursday, August 28, 2014 12:43 AM
    Moderator
  • The proposed Solution did not use PowerShell.

    Let me give more details.  We are using the MDTDB for all configurations.  I am looking at scripting the initial setup of the environment.  I am able to use the New-MDTMakeModel CMDlet to add the many Make/Models that we have.  I can add individual settings, I just cannot assign a application to that make and model via PowerShell.  I can manually click in the GUI to assign the application / GUID to the make/model. 

    Thursday, August 28, 2014 2:06 PM
  • Oh, you are using Mike Niehaus's MDT Database add-on pack, and you want to associate Makes and Models to the database using Powershell against the *DATABASE* not use Powershell on the Client.

    Sure, how about this:

    import-module .\MDTDB.psm1 
    connect-mdtdatabase -sqlserver $Server -instance SQLEXPRESS -database MDTDatabase 
    import-csv .\Models.csv | New-MDTMakeModel -settings @{Applications001='GUID_HERE'}


    Keith Garner - Principal Consultant [owner] - http://DeploymentLive.com


    Thursday, August 28, 2014 6:28 PM
    Moderator
  • Looks like that does no work either:

    PS C:\Users\Administrator\Documents> New-MDTMakeModel -make 'VMware, Inc. 001' -model 'VMware Virtual Platform' -settings @{Application001="5da3d622-c936-4ccc-836e-f5833da0d416"}

    Exception calling "ExecuteScalar" with "0" argument(s): "Invalid column name 'A
    pplication001'."
    At C:\Users\Administrator\Downloads\mdtdb\MDTDB.psm1:1177 char:43
    +         $null = $settingsCmd.ExecuteScalar <<<< ()
        + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
        + FullyQualifiedErrorId : DotNetMethodException

    Added settings for the specified make model

    The Make and Model get added but the applications are not assigned.  I had copied the guid directly from the workbench.  What is interesting is that when something successfully is imported the list of all available options appear, however Application is not one of them.

    Thursday, August 28, 2014 11:13 PM
  • Could be a typo in my script, changed above should be Applications not application

    Keith Garner - Principal Consultant [owner] - http://DeploymentLive.com

    Thursday, August 28, 2014 11:16 PM
    Moderator
  • Negative Application and Applications produce the same results
    Thursday, August 28, 2014 11:22 PM
  • OK I just read the article, and it appears that Applications have a slightly different syntax. Check the article for usage

    Keith Garner - Principal Consultant [owner] - http://DeploymentLive.com

    • Marked as answer by Keith Templin Friday, August 29, 2014 12:54 AM
    Thursday, August 28, 2014 11:36 PM
    Moderator
  • I see it now, man cannot believe I missed that.  Here is the statement that worked:

    New-MDTMakeModel -make 'VMware, Inc.' -model 'VMware Virtual Platform' -settings @{OSInstall='YES'} | Set-MDTMakeModelApplication -applications @('{5da3d622-c936-4ccc-836e-f5833da0d416}')

    Friday, August 29, 2014 12:54 AM