Answered by:
WHY use HCK API lfailed (powershell) ?

Question
-
Hi,
I want to automated WHQL Test .
Tried following steps :
1.Copy the code from http://msdn.microsoft.com/en-us/library/windows/hardware/jj125307.aspx and save it as ListProjects.ps1
2.\powershell.exe -file ListProjects.ps1 S2HCK
3.
Usage: %SystemRoot%\syswow64\WindowsPowerShell\v1.0\powershell.exe -file ListProjects.ps1 <<ControllerName>>
connecting to the controller S2HCK
New-Object : Cannot find type [Microsoft.Windows.Kits.Hardware.ObjectModel.DBConnection.DatabaseProjectManager]: make s
ure the assembly containing this type is loaded.
At C:\Users\Administrator\Desktop\ListProjects.ps1:19 char:22
+ $Manager = new-object <<<< -typename Microsoft.Windows.Kits.Hardware.ObjectModel.DBConnection.DatabaseProjectManager
-Args $ControllerName, DTMJobs
+ CategoryInfo : InvalidType: (:) [New-Object], PSArgumentException
+ FullyQualifiedErrorId : TypeNotFound,Microsoft.PowerShell.Commands.NewObjectCommand
You cannot call a method on a null-valued expression.
At C:\Users\Administrator\Desktop\ListProjects.ps1:20 char:40
+ $RootPool = $Manager.GetRootMachinePool <<<< ();
+ CategoryInfo : InvalidOperation: (GetRootMachinePool:String) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
All project names on this controller
You cannot call a method on a null-valued expression.
At C:\Users\Administrator\Desktop\ListProjects.ps1:24 char:25
+ $Manager.GetProjectNames <<<< ()
+ CategoryInfo : InvalidOperation: (GetProjectNames:String) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
You cannot call a method on a null-valued expression.
At C:\Users\Administrator\Desktop\ListProjects.ps1:27 char:28
+ $Manager.GetProjectInfoList <<<< () | foreach {
+ CategoryInfo : InvalidOperation: (GetProjectInfoList:String) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
You cannot call a method on a null-valued expression.
At C:\Users\Administrator\Desktop\ListProjects.ps1:37 char:25
+ $Manager.GetProjectNames <<<< () | foreach {
+ CategoryInfo : InvalidOperation: (GetProjectNames:String) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNullHow to slove the issue above ?
Thanks,
Best Regards, Mike
- Moved by HLK Moderator Wednesday, October 3, 2012 6:00 PM Move to new forum (From:Windows Hardware WDK and Driver Development)
Monday, July 23, 2012 9:12 AM
Answers
-
Powershell has some nuances around .NET. You should look at the following -
- Tell powershell which version of .NET to use as noted in http://tfl09.blogspot.com/2010/08/using-newer-versions-of-net-with.html, or set the registry like "reg add hklm\software\wow6432node\microsoft\.netframework /v OnlyUseLatestCLR /t REG_DWORD /d 1" as noted in http://stackoverflow.com/questions/2094694/how-can-i-run-powershell-with-the-net-4-runtime
- Also, since you are running on a 64-bit machine, you should directly run the 64-bit version of powershell located in "%SystemRoot%\syswow64\WindowsPowerShell\v1.0\powershell.exe"
John -- This posting is provided "AS IS" with no warranties, and confers no rights.
- Edited by John Garcia (HCK) Tuesday, July 24, 2012 4:14 AM typo about 64-bit version of powershell
- Marked as answer by Doron Holan [MSFT] Tuesday, July 24, 2012 7:15 AM
Tuesday, July 24, 2012 4:12 AM -
Known bug with the script. The namespace changed. On lines 59, 73, and 81, change namespace from "Microsoft.Windows.LogoKit.ObjectModel..." to "Microsoft.Windows.Kits.Hardware.ObjectModel..."
John -- This posting is provided "AS IS" with no warranties, and confers no rights.
- Proposed as answer by John Garcia (HCK) Tuesday, July 24, 2012 4:25 PM
- Marked as answer by Doron Holan [MSFT] Tuesday, July 24, 2012 10:45 PM
Tuesday, July 24, 2012 4:24 PM
All replies
-
I've seen this message but the solution had to do with the configuration of the system. Some questions to help me understand your usage -
1. Are you running this on a machine that has HCK Studio installed?
2. Is your machine 32 or 64 bit?
3. Sometimes, there are errors message about the "Usage: %SystemRoot%\syswow64\WindowsPowerShell\v1.0\powershell.exe -file ListProjects.ps1 <<ControllerName>>" line. Did you have any error messages above that line?
John -- This posting is provided "AS IS" with no warranties, and confers no rights.
Monday, July 23, 2012 6:38 PM -
Reply:
1. I am running this on the host w/ HCK studio and HCK controller
2.win2k8R2 64 bit guests
3.No errors above that line
Hope to hear you soon
Best Regards, Mike
Tuesday, July 24, 2012 2:43 AM -
For 3rd quesiton:
It has .
Exception calling "LoadFrom" with "1" argument(s): "Could not load file or assembly 'file:///C:\Program Files (x86)\Win
dows Kits\8.0\Hardware Certification Kit\Studio\microsoft.windows.Kits.Hardware.objectmodel.dll' or one of its dependen
cies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded."
At C:\Users\Administrator\Desktop\ListProjects.ps1:1 char:47
+ $ObjectModel = [Reflection.Assembly]::LoadFrom <<<< ($env:WTTSTDIO + "microsoft.windows.Kits.Hardware.objectmodel.dll
")
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException
Exception calling "LoadFrom" with "1" argument(s): "Could not load file or assembly 'file:///C:\Program Files (x86)\Win
dows Kits\8.0\Hardware Certification Kit\Studio\microsoft.windows.Kits.Hardware.objectmodel.dbconnection.dll' or one of
its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded."
At C:\Users\Administrator\Desktop\ListProjects.ps1:2 char:47
+ $ObjectModel = [Reflection.Assembly]::LoadFrom <<<< ($env:WTTSTDIO + "microsoft.windows.Kits.Hardware.objectmodel.dbc
onnection.dll")
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException
Usage: %SystemRoot%\syswow64\WindowsPowerShell\v1.0\powershell.exe -file ListProjects.ps1 <<ControllerName>>Best Regards, Mike
Tuesday, July 24, 2012 2:51 AM -
what version of .net are you using?
d -- This posting is provided "AS IS" with no warranties, and confers no rights.
Tuesday, July 24, 2012 3:23 AM -
.net Framework4 Client Profile 4.0.30319
Best Regards, Mike
Tuesday, July 24, 2012 3:33 AM -
Powershell has some nuances around .NET. You should look at the following -
- Tell powershell which version of .NET to use as noted in http://tfl09.blogspot.com/2010/08/using-newer-versions-of-net-with.html, or set the registry like "reg add hklm\software\wow6432node\microsoft\.netframework /v OnlyUseLatestCLR /t REG_DWORD /d 1" as noted in http://stackoverflow.com/questions/2094694/how-can-i-run-powershell-with-the-net-4-runtime
- Also, since you are running on a 64-bit machine, you should directly run the 64-bit version of powershell located in "%SystemRoot%\syswow64\WindowsPowerShell\v1.0\powershell.exe"
John -- This posting is provided "AS IS" with no warranties, and confers no rights.
- Edited by John Garcia (HCK) Tuesday, July 24, 2012 4:14 AM typo about 64-bit version of powershell
- Marked as answer by Doron Holan [MSFT] Tuesday, July 24, 2012 7:15 AM
Tuesday, July 24, 2012 4:12 AM -
Hi, Thanks the scripts could run ,but I hit a new issue :
Target : WIN-FLFMP3GSQRU
Type : System
Key : EA93A71C-B156-4DF4-83B1-585B6E8A32EB
Unable to find type [Microsoft.Windows.LogoKit.ObjectModel.IDeviceTargetData]: make sure that the assembly containing t
his type is loaded.
At C:\Users\Administrator\Desktop\ListProjects.ps1:59 char:96
+ $DeviceData = $_ -AS [Microsoft.Windows.LogoKit.ObjectModel.IDeviceTargetData] <<<<
+ CategoryInfo : InvalidOperation: (Microsoft.Windo...eviceTargetData:String) [], RuntimeException
+ FullyQualifiedErrorId : TypeNotFound
Unable to find type [Microsoft.Windows.LogoKit.ObjectModel.ISystemTargetData]: make sure that the assembly containing t
his type is loaded.
At C:\Users\Administrator\Desktop\ListProjects.ps1:73 char:95
+ $SystemData = $_ -AS [Microsoft.Windows.LogoKit.ObjectModel.ISystemTargetData] <<<<
+ CategoryInfo : InvalidOperation: (Microsoft.Windo...ystemTargetData:String) [], RuntimeException
+ FullyQualifiedErrorId : TypeNotFound
Unable to find type [Microsoft.Windows.LogoKit.ObjectModel.IFilterTargetData]: make sure that the assembly containing t
his type is loaded.
At C:\Users\Administrator\Desktop\ListProjects.ps1:81 char:95
+ $FilterData = $_ -AS [Microsoft.Windows.LogoKit.ObjectModel.IFilterTargetData] <<<<
+ CategoryInfo : InvalidOperation: (Microsoft.Windo...ilterTargetData:String) [], RuntimeException
+ FullyQualifiedErrorId : TypeNotFound
What may cause this ?
BTW Is there a docs/command do make know all the api interfaces for HCK ?
Thanks,
Best Regards, Mike
Tuesday, July 24, 2012 5:33 AM -
Known bug with the script. The namespace changed. On lines 59, 73, and 81, change namespace from "Microsoft.Windows.LogoKit.ObjectModel..." to "Microsoft.Windows.Kits.Hardware.ObjectModel..."
John -- This posting is provided "AS IS" with no warranties, and confers no rights.
- Proposed as answer by John Garcia (HCK) Tuesday, July 24, 2012 4:25 PM
- Marked as answer by Doron Holan [MSFT] Tuesday, July 24, 2012 10:45 PM
Tuesday, July 24, 2012 4:24 PM -
Thanks, It works
Best Regards, Mike
Monday, July 30, 2012 5:22 AM