none
[HCK2.1][automation] How to Generate HCKx Package RRS feed

  • Question

  • Hi, Everyone ,Following is my code  ( I am sure I pass project object to this function properly) ,any one can help to review it ?

    $Submission   = [Reflection.Assembly]::LoadFrom($env:WTTSTDIO + "microsoft.windows.Kits.Hardware.objectmodel.submission.dll")
    

    function GenerateHCKPackage($project)

    {
    $packageWriter = new-object  -typename Microsoft.Windows.Kits.Hardware.ObjectModel.Submission.LogoPackageWriter -Args $project
    $saveFileName = $project.Name

         $packageWriter.Save($saveFileName);
         # now that you're finished writing the package, dispose of it to make sure that the file handle is closed
         $packageWriter.Dispose();


    }

    Error logs :

    New-Object : Cannot find type [Microsoft.Windows.Kit.ObjectModel.Submission.LogoPackageWriter]: make sure the assembly
    containing this type is loaded.
    At C:\Users\Administrator\Documents\GitHub\whql_autoit\Generate_Job_Summary.ps1:31 char:30
    +      $packageWriter = new-object <<<<   -typename Microsoft.Windows.Kit.ObjectModel.Submission.LogoPackageWriter -Arg
    s $project
        + CategoryInfo          : InvalidType: (:) [New-Object], PSArgumentException
        + FullyQualifiedErrorId : TypeNotFound,Microsoft.PowerShell.Commands.NewObjectCommand


                             ConnectionType VersionString                           Version
                             -------------- -------------                           -------
                                   Database 8.100.9431.9621                         8.100.9431.9621
    You cannot call a method on a null-valued expression.
    At C:\Users\Administrator\Documents\GitHub\whql_autoit\Generate_Job_Summary.ps1:40 char:25
    +      $packageWriter.Save <<<< ($saveFileName);
        + CategoryInfo          : InvalidOperation: (Save:String) [], RuntimeException
        + FullyQualifiedErrorId : InvokeMethodOnNull

    You cannot call a method on a null-valued expression.
    At C:\Users\Administrator\Documents\GitHub\whql_autoit\Generate_Job_Summary.ps1:42 char:28
    +      $packageWriter.Dispose <<<< ();
        + CategoryInfo          : InvalidOperation: (Dispose:String) [], RuntimeException
        + FullyQualifiedErrorId : InvokeMethodOnNull

    New-Object : A positional parameter cannot be found that accepts argument 'new-object'.
    At C:\Users\Administrator\Documents\GitHub\whql_autoit\Generate_Job_Summary.ps1:45 char:34
    +      $packageManager = new-Object <<<<  new-object  -typename Microsoft.Windows.LogoKit.ObjectModel.Submission.Packag
    eManager -Args $saveFileName
        + CategoryInfo          : InvalidArgument: (:) [New-Object], ParameterBindingException
        + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.NewObjectCommand


    Best Regards, Mike

    Friday, September 6, 2013 8:47 AM

Answers

  • Mike,

    It should be PackageWriter and not LogoPackageWriter.

    $packageWriter = new-object -typename Microsoft.Windows.Kits.Hardware.ObjectModel.Submission.PackageWriter -Args $project

    Please refer to the updated sample code here .

    Thanks!

    Friday, September 6, 2013 6:34 PM
  • My issue resloved after changing Microsoft.Windows.Kits.Hardware.ObjectModel.Submission.LogoPackageWriter to Microsoft.Windows.Kits.Hardware.ObjectModel.Submission.PackageWriter 

    MSFT should change your examples 

    Mike


    Best Regards, Mike

    • Marked as answer by Mike_Cao Monday, September 9, 2013 2:40 AM
    Monday, September 9, 2013 2:37 AM

All replies

  • Just to be sure, are you running on a 64-bit system but should be using the 32-bit version of PowerShell?

    John -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Friday, September 6, 2013 4:31 PM
  • Mike,

    It should be PackageWriter and not LogoPackageWriter.

    $packageWriter = new-object -typename Microsoft.Windows.Kits.Hardware.ObjectModel.Submission.PackageWriter -Args $project

    Please refer to the updated sample code here .

    Thanks!

    Friday, September 6, 2013 6:34 PM
  • My issue resloved after changing Microsoft.Windows.Kits.Hardware.ObjectModel.Submission.LogoPackageWriter to Microsoft.Windows.Kits.Hardware.ObjectModel.Submission.PackageWriter 

    MSFT should change your examples 

    Mike


    Best Regards, Mike

    • Marked as answer by Mike_Cao Monday, September 9, 2013 2:40 AM
    Monday, September 9, 2013 2:37 AM
  • Yes ,absolutely !

    Mike


    Best Regards, Mike

    Monday, September 9, 2013 2:37 AM
  • So we can make any necessary corrections to the samples, it sounds like you used the examples in the install help file? If that is the case, can you let me know which build you are using. The online updates happen quicker (more immediate) but the installed help files tend to happen on various releases.

    John -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Monday, September 9, 2013 4:11 PM
  • I am using HCK2.1 RTM  with QFE1 one

    Best Regards, Mike

    Thursday, September 12, 2013 5:38 AM
  • Mike,

    Do you have any idea how to automate the process of merging multiple .hckx files through scripting?

    Wednesday, September 18, 2013 7:32 AM
  • In the "Creating a Package" example, you can invoke the merge method in the packageWriter object - packageWriter.Merge($project, $errors)

    John -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Wednesday, September 18, 2013 5:31 PM