Duplex WIA scan properties missing - powershell

I can't access/find the duplex property / setting on my scanner via Powershell and via WIA 2.0 .
I 've installed the correct drivers but it seems, that alot of properties are missing (see below).
Am I reading from the wrong device properties? -> device.Properties["Document Handling Select"] = 5 (found here WIA 2.0 Duplex scanning ).
The scanner scans both pages in 1 turn (double-sided scan).
Tried several "fixes" of other questions, including calling the image item.transfer twice - doesn't provide the backpage though.
What works:
Everything, including scanning a page and saving it into a .tiff file
What doesn't work:
Duplex - I 've searched millions of sites, WIA 2.0 documentation, but I can't seem to find the right property to set the device.Properties["Document Handling Select"] = 5 (found here WIA 2.0 Duplex scanning )
The Scanner is Duplex and works with duplex in every standard scan setting
Powershell snippet
While ($true) {
"in While"
Try{
$deviceManager = new-object -ComObject WIA.DeviceManager
"Devices: " + $deviceManager.DeviceInfos.Count()
$device = $deviceManager.DeviceInfos.Item(1).Connect()
} catch {
"while break"
$error
break
}
$x = 1
while ($x -lt 17){
$device.Properties($x)
$x = $x + 1
}
$imageProcess = new-object -ComObject WIA.ImageProcess
$wiaFormatTIFF = "{B96B3CB1-0728-11D3-9D7B-0000F81EF32E}"
foreach ($item in $device.Items) {
"device items: " + $device.Items.Count
$image = $item.Transfer($wiaFormatTIFF)
$imageback = $item.Transfer($wiaFormatTIFF)
Property output
Properties output of Powershell device properties over USB:
Name : User Name
PropertyID : 3112
Type : 16
IsReadOnly : True
IsVector : False
SubType : 0
SubTypeDefault :
SubTypeValues :
SubTypeMin :
SubTypeMax :
SubTypeStep :
Value : Root
Name : Item Name
PropertyID : 4098
Type : 16
IsReadOnly : True
IsVector : False
SubType : 0
SubTypeDefault :
SubTypeValues :
SubTypeMin :
SubTypeMax :
SubTypeStep :
Value : 0001\Root
Name : Full Item Name
PropertyID : 4099
Type : 16
IsReadOnly : True
IsVector : False
SubType : 0
SubTypeDefault :
SubTypeValues :
SubTypeMin :
SubTypeMax :
SubTypeStep :
Value : 76
Name : Item Flags
PropertyID : 4101
Type : 5
IsReadOnly : True
IsVector : False
SubType : 0
SubTypeDefault :
SubTypeValues :
SubTypeMin :
SubTypeMax :
SubTypeStep :
Value : {6BDD1FC6-810F-11D0-BEC7-08002BE2092F}\0001
Name : Unique Device ID
PropertyID : 2
Type : 16
IsReadOnly : False
IsVector : False
SubType : 0
SubTypeDefault :
SubTypeValues :
SubTypeMin :
SubTypeMax :
SubTypeStep :
Value : CANON
Name : Manufacturer
PropertyID : 3
Type : 16
IsReadOnly : True
IsVector : False
SubType : 0
SubTypeDefault :
SubTypeValues :
SubTypeMin :
SubTypeMax :
SubTypeStep :
Value : CANON DR-M140 USB
Name : Description
PropertyID : 4
Type : 16
IsReadOnly : True
IsVector : False
SubType : 0
SubTypeDefault :
SubTypeValues :
SubTypeMin :
SubTypeMax :
SubTypeStep :
Value : 65536
Name : Type
PropertyID : 5
Type : 5
IsReadOnly : True
IsVector : False
SubType : 0
SubTypeDefault :
SubTypeValues :
SubTypeMin :
SubTypeMax :
SubTypeStep :
Value : \\.\Usbscan4
Name : Port
PropertyID : 6
Type : 16
IsReadOnly : True
IsVector : False
SubType : 0
SubTypeDefault :
SubTypeValues :
SubTypeMin :
SubTypeMax :
SubTypeStep :
Value : CANON DR-M140 USB
Name : Name
PropertyID : 7
Type : 16
IsReadOnly : True
IsVector : False
SubType : 0
SubTypeDefault :
SubTypeValues :
SubTypeMin :
SubTypeMax :
SubTypeStep :
Value : local
Name : Server
PropertyID : 8
Type : 16
IsReadOnly : False
IsVector : False
SubType : 0
SubTypeDefault :
SubTypeValues :
SubTypeMin :
SubTypeMax :
SubTypeStep :
Value :
Name : Remote Device ID
PropertyID : 9
Type : 16
IsReadOnly : False
IsVector : False
SubType : 0
SubTypeDefault :
SubTypeValues :
SubTypeMin :
SubTypeMax :
SubTypeStep :
Value : {B763D1FD-94C8-4ef6-B5E8-E7F3086CF161}
Name : UI Class ID
PropertyID : 10
Type : 16
IsReadOnly : True
IsVector : False
SubType : 0
SubTypeDefault :
SubTypeValues :
SubTypeMin :
SubTypeMax :
SubTypeStep :
Value : 0
Name : Hardware Configuration
PropertyID : 11
Type : 5
IsReadOnly : True
IsVector : False
SubType : 0
SubTypeDefault :
SubTypeValues :
SubTypeMin :
SubTypeMax :
SubTypeStep :
Value :
Name : BaudRate
PropertyID : 12
Type : 16
IsReadOnly : True
IsVector : False
SubType : 0
SubTypeDefault :
SubTypeValues :
SubTypeMin :
SubTypeMax :
SubTypeStep :
Value : 19
Name : STI Generic Capabilities
PropertyID : 13
Type : 5
IsReadOnly : True
IsVector : False
SubType : 0
SubTypeDefault :
SubTypeValues :
SubTypeMin :
SubTypeMax :
SubTypeStep :
device items: 1

Okay, actually the scanner didn't have the property for duplex, while beeing duplex.
Tried it with another scanner and with that property it works.
Try {
"device items: " + $device.Items.Count
$device.Properties["3088"].Value = 5 <--- Duplex property 5, ID 3088
$device.Properties["3087"].Value
$imageback = $item.Transfer($wiaFormatTIFF)
} catch {
"while break"
$error
$killwhile = 1
break
}

Related

How to read all properties of json line by line in powershell code

isEnabled : True
isBlocking : True
isDeleted : False
settings : #{scope=System.Object[]}
isEnterpriseManaged : False
_links : #{self=; policyType=}
revision : -1
id : -1
url : https://dev.azure.com/accenturecio01/4f4fc83f-91fb-4a0b-a81c-56113f9559f2/_apis/policy/configurations/-1
type : #{id=90231074-b810-4521-ac14-ca5aa6781f42;
url=https://dev.azure.com/accenturecio01/4f4fc83f-91fb-4a0b-a81c-56113f9559f2/_apis/policy/types/90231074-b810-4521-ac14-ca5aa6781f42;
displayName=Commit entries restriction}
createdBy : #{displayName=Ravindra Dacharla;
url=https://spsprodcus1.vssps.visualstudio.com/A5cb9ba94-b73a-4bf8-bf15-d520120bbeb2/_apis/Identities/0900d461-2aea-64aa-8b9a-f0ee02d99f73;
_links=; id=0900d461-2aea-64aa-8b9a-f0ee02d99f73; uniqueName=ravindra.dacharla#accenture.com;
imageUrl=https://dev.azure.com/accenturecio01/_api/_common/identityImage?id=0900d461-2aea-64aa-8b9a-f0ee02d99f73;
descriptor=aad.MDkwMGQ0NjEtMmFlYS03NGFhLThiOWEtZjBlZTAyZDk5Zjcz}
createdDate : 2022-12-29T04:53:34.5242202Z
isEnabled : True
isBlocking : True
isDeleted : False
settings : #{minimumApproverCount=2; creatorVoteCounts=False; allowDownvotes=False; resetOnSourcePush=False; requireVoteOnLastIteration=False;
resetRejectionsOnSourcePush=False; blockLastPusherVote=False; scope=System.Object[]}
isEnterpriseManaged : False
_links : #{self=; policyType=}
revision : 1
id : 5756
url : https://dev.azure.com/accenturecio01/4f4fc83f-91fb-4a0b-a81c-56113f9559f2/_apis/policy/configurations/5756
type : #{id=fa4e907d-c16b-4a4c-9dfa-4906e5d171dd;
url=https://dev.azure.com/accenturecio01/4f4fc83f-91fb-4a0b-a81c-56113f9559f2/_apis/policy/types/fa4e907d-c16b-4a4c-9dfa-4906e5d171dd;
displayName=Minimum number of reviewers}
this is my json output i want to fetch the value of minimumApproverCount=2 only when type: displayname = Minimum number of reviewers.

How to group SQL DataRow results by Name depending on condition

I get results from a SQL Table with this command:
$GetData = Invoke-Sqlcmd -ConnectionString $Connection -Query $GetQuery
One single result looks like this (there are about 500 of these results):
ID : 1584
ObjId :
ARTIKEL_NR : 0
ArtBeschrieb1_3 :
KLASSE : TbXAusführungen
SMB1 : Produkt
SMW1 : TbA
SMN1 :
SMB2 : Ausführung
SMW2 : 2M-Zarge Front
SMN2 :
SMB3 : Boxtypen
SMW3 : B;C-M;D-M
SMN3 :
SMB4 : SortKZ
SMW4 :
SMN4 : 2.000000
SMB5 :
SMW5 :
SMN5 :
SMB6 :
SMW6 :
SMN6 :
SMB7 :
SMW7 :
SMN7 :
SMB8 :
SMW8 :
SMN8 :
SMB9 :
SMW9 :
SMN9 :
SMB10 :
SMW10 :
SMN10 :
SMB11 :
SMW11 :
SMN11 :
SMB12 :
SMW12 :
SMN12 :
SMB13 :
SMW13 :
SMN13 :
SMB14 :
SMW14 :
SMN14 :
SMB15 :
SMW15 :
SMN15 :
SMB16 :
SMW16 :
SMN16 :
SMB17 :
SMW17 :
SMN17 :
SMB18 :
SMW18 :
SMN18 :
SMB19 :
SMW19 :
SMN19 :
SMB20 :
SMW20 :
SMN20 :
SMB21 :
SMW21 :
SMN21 :
SMB22 :
SMW22 :
SMN22 :
SMB23 :
SMW23 :
SMN23 :
SMB24 :
SMW24 :
SMN24 :
SMB25 :
SMW25 :
SMN25 :
SMB26 :
SMW26 :
SMN26 :
SMB27 :
SMW27 :
SMN27 :
SMB28 :
SMW28 :
SMN28 :
SMB29 :
SMW29 :
SMN29 :
SMB30 :
SMW30 :
SMN30 :
DividendPreisEinhet : 0
SMB31 :
SMW31 :
SMN31 :
ArtBeschrieb1_2FR :
SMB32 :
SMW32 :
SMN32 :
OOPreisklasse :
SMB33 :
SMW33 :
SMN33 :
SMB34 :
SMW34 :
SMN34 :
SMB35 :
SMW35 :
SMN35 :
SMB36 :
SMW36 :
SMN36 :
SMB37 :
SMW37 :
SMN37 :
SMB38 :
SMW38 :
SMN38 :
SMB39 :
SMW39 :
SMN39 :
SMB40 :
SMW40 :
SMN40 :
As You can see there are always 3 SM* Properties with the same Number. I would like to group them. SMB* should become the Property Name and either SMW* or SMN* the PropertyValue, depending on which is NULL and which is not.
I think I can do the PropertyName / PropertyValue part on my own, but how can I group all corresponding SM* fields?
btw: The Fields that are not SM* fields are already OK, they should stay the way they are.
I know there is $PSObject.Properties but that does not seem to help me here?
PS Z:\Powershell-Scripts> $GetData.gettype()
IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True True Object[] System.Array
Below code should do what you want:
$GetData = Invoke-Sqlcmd -ConnectionString $Connection -Query $GetQuery
$result = foreach ($item in $GetData) {
# create an Ordered hash to collect the item data
$newObject = [ordered]#{}
# get all property names in order
$propNames = ($item.PsObject.Properties).Name
for ($i = 0; $i -lt $propNames.Count; $i++) {
$name = $propNames[$i]
if ($name -notlike 'SM*') {
$newObject[$name] = $item.$name
}
else {
$num = $name -replace '\D'
$value = if ([string]::IsNullOrWhiteSpace($item."SMW$num")) { $item."SMN$num" } else { $item."SMW$num" }
$newObject["SMB$num"] = $value
$i += 2
}
}
[PsCustomObject]$newObject
}
# output on console
$result
# output to CSV
$result | Export-Csv -Path 'D:\QueryResultCondensed.csv' -NoTypeInformation
Output for the example item:
ID : 1584
ObjId :
ARTIKEL_NR : 0
ArtBeschrieb1_3 :
KLASSE : TbXAusführungen
SMB1 : TbA
SMB2 : 2M-Zarge Front
SMB3 : B;C-M;D-M
SMB4 : 2.000000
SMB5 :
SMB6 :
SMB7 :
SMB8 :
SMB9 :
SMB10 :
SMB11 :
SMB12 :
SMB13 :
SMB14 :
SMB15 :
SMB16 :
SMB17 :
SMB18 :
SMB19 :
SMB20 :
SMB21 :
SMB22 :
SMB23 :
SMB24 :
SMB25 :
SMB26 :
SMB27 :
SMB28 :
SMB29 :
SMB30 :
DividendPreisEinhet : 0
SMB31 :
ArtBeschrieb1_2FR :
SMB32 :
OOPreisklasse :
SMB33 :
SMB34 :
SMB35 :
SMB36 :
SMB37 :
SMB38 :
SMB39 :
SMB40 :
This was what I was actually looking for - sorry for not explaining it well enough
$GetData = Invoke-Sqlcmd -ConnectionString $ConnectionLogik -Query $GetQuery
$NewData = foreach ($dat in $GetData)
{
# Get rid of empty and useless Properties
$NotArray = #("RowState","ItemArray","HasErrors")
$Objects = $dat.Psobject.properties |
Where-Object {![string]::IsNullOrWhiteSpace($_.Value) -and $_.Name -notin $NotArray} |
Select-Object Name, Value
# Create new Properties from pairs
$SingleObject = [ordered]#{}
foreach ($obj in $Objects) {
if ($obj.Name -like 'SM*') {
if ($obj.Name -like 'SMW*' -or $obj.Name -like 'SMN*') { Continue }
$match = 'SM[NW]' + $obj.Name.Substring(3) + '$'
$val = $Objects | Where-Object { $_.Name -match $match } | Select -Expand Value
$SingleObject[$obj.Value] = $val
} else {
$SingleObject[$obj.Name] = $obj.Value
}
}
[PSCustomObject]$SingleObject
}
This will leave me with output like this:
ID : 1584
ARTIKEL_NR : 0
KLASSE : TbXAusführungen
Produkt : TbA
Ausführung : 2M-Zarge Front
Boxtypen : B;C-M;D-M
SortKZ : 2.000000
DividendPreisEinhet : 0
ID : 443
ObjId : 20854
ARTIKEL_NR : 14.39007.00
ArtBeschrieb1_3 : Verpackung
KLASSE : TbALeistungenAntaro
TextID : Material.Verpackung
DividendPreisEinhet : 1
ID : 1528
ARTIKEL_NR : 0
KLASSE : TbXFrontbefestigung
ArtNoBlum :
Bezeichnung : keine
DividendPreisEinhet : 0
Which I was then able to export to CSV grouped by each KLASSE Property
$NewData | Group-Object KLASSE | ForEach-Object { $_.Group | Export-Csv I:\TRANSFER\$($_.Name).csv -delimiter ';' -NoTypeInformation }

Missing Containers Cmdlet

I created the new Server Core (Windows 2016). I can't find the all container cmdlet in powershell. I did Uninstall/installed the containers feature but still missing all cmdlet. How do i get containers cmdlet in powershell?
Here is my server info.
WindowsBuildLabEx : 16299.15.amd64fre.rs3_release.170928-1534
WindowsCurrentVersion : 6.3
WindowsEditionId : ServerDatacenterACor
WindowsInstallationType : Server Core
WindowsInstallDateFromRegistry : 28/4/2018 12:41:19 PM
WindowsProductId : 00395-60000-00001-AA842
WindowsProductName : Windows Server Datacenter
WindowsRegisteredOrganization :
WindowsRegisteredOwner : Windows User
WindowsSystemRoot : C:\Windows
WindowsVersion : 1709
BiosCharacteristics : {3, 9, 15, 16...}
BiosBIOSVersion : {VRTUAL - 1, Hyper-V UEFI Release v2.5, Microsoft - 100032}
BiosBuildNumber :
BiosCaption : Hyper-V UEFI Release v2.5
BiosCodeSet :
BiosCurrentLanguage :
BiosDescription : Hyper-V UEFI Release v2.5
BiosEmbeddedControllerMajorVersion : 255
BiosEmbeddedControllerMinorVersion : 255
BiosFirmwareType : Uefi
BiosIdentificationCode :
BiosInstallableLanguages :
BiosInstallDate :
BiosLanguageEdition :
BiosListOfLanguages :
BiosManufacturer : Microsoft Corporation
BiosName : Hyper-V UEFI Release v2.5
BiosOtherTargetOS :
BiosPrimaryBIOS : True
BiosReleaseDate : 22/8/2017 8:00:00 AM
BiosSeralNumber : 8355-6248-8581-2148-3845-5374-58
BiosSMBIOSBIOSVersion : Hyper-V UEFI Release v2.5
BiosSMBIOSMajorVersion : 2
BiosSMBIOSMinorVersion : 4
BiosSMBIOSPresent : True
BiosSoftwareElementState : Running
BiosStatus : OK
BiosSystemBiosMajorVersion : 2
BiosSystemBiosMinorVersion : 5
BiosTargetOperatingSystem : 0
BiosVersion : VRTUAL - 1
CsAdminPasswordStatus : Unknown
CsAutomaticManagedPagefile : True
CsAutomaticResetBootOption : True
CsAutomaticResetCapability : True
CsBootOptionOnLimit :
CsBootOptionOnWatchDog :
CsBootROMSupported : True
CsBootStatus : {0, 0, 0, 127...}
CsBootupState : Normal boot
CsCaption : WIN16DCORE
CsChassisBootupState : Safe
CsChassisSKUNumber :
CsCurrentTimeZone : 480
CsDaylightInEffect :
CsDescription : AT/AT COMPATIBLE
CsDNSHostName : WIN16DCore
CsDomain : WORKGROUP
CsDomainRole : StandaloneServer
CsEnableDaylightSavingsTime : True
CsFrontPanelResetStatus : Unknown
CsHypervisorPresent : True
CsInfraredSupported : False
CsInitialLoadInfo :
CsInstallDate :
CsKeyboardPasswordStatus : Unknown
CsLastLoadInfo :
CsManufacturer : Microsoft Corporation
CsModel : Virtual Machine
CsName : WIN16DCORE
CsNetworkAdapters : {vEthernet - 1}
CsNetworkServerModeEnabled : True
CsNumberOfLogicalProcessors : 1
CsNumberOfProcessors : 1
CsProcessors : {Intel(R) Core(TM) i3-2100 CPU # 3.10GHz}
CsOEMStringArray : {[MS_VM_CERT/SHA1/9b80ca0d5dd061ec9da4e494f4c3fd1196270c22],
00000000000000000000000000000000, To be filled by OEM}
CsPartOfDomain : False
CsPauseAfterReset : -1
CsPCSystemType : Desktop
CsPCSystemTypeEx : Desktop
CsPowerManagementCapabilities :
CsPowerManagementSupported :
CsPowerOnPasswordStatus : Unknown
CsPowerState : Unknown
CsPowerSupplyState : Safe
CsPrimaryOwnerContact :
CsPrimaryOwnerName : Windows User
CsResetCapability : Other
CsResetCount : -1
CsResetLimit : -1
CsRoles : {LM_Workstation, LM_Server, NT, Server_NT}
CsStatus : OK
CsSupportContactDescription :
CsSystemFamily : Virtual Machine
CsSystemSKUNumber : None
CsSystemType : x64-based PC
CsThermalState : Safe
CsTotalPhysicalMemory : 5082476544
CsPhyicallyInstalledMemory : 4964352
CsUserName :
CsWakeUpType : PowerSwitch
CsWorkgroup : WORKGROUP
OsName : Microsoft Windows Server Datacenter
OsType : WINNT
OsOperatingSystemSKU : 145
OsVersion : 10.0.16299
OsCSDVersion :
OsBuildNumber : 16299
OsHotFixes : {KB4099989, KB4093112}
OsBootDevice : \Device\HarddiskVolume2
OsSystemDevice : \Device\HarddiskVolume4
OsSystemDirectory : C:\Windows\system32
OsSystemDrive : C:
OsWindowsDirectory : C:\Windows
OsCountryCode : 65
OsCurrentTimeZone : 480
OsLocaleID : 4809
OsLocale : en-SG
OsLocalDateTime : 29/4/2018 1:35:42 PM
OsLastBootUpTime : 29/4/2018 1:23:23 PM
OsUptime : 00:12:18.3221697
OsBuildType : Multiprocessor Free
OsCodeSet : 1252
OsDataExecutionPreventionAvailable : True
OsDataExecutionPrevention32BitApplications : True
OsDataExecutionPreventionDrivers : True
OsDataExecutionPreventionSupportPolicy : OptOut
OsDebug : False
OsDistributed : False
OsEncryptionLevel : 256
OsForegroundApplicationBoost : Maximum
OsTotalVisibleMemorySize : 4963356
OsFreePhysicalMemory : 4239756
OsTotalVirtualMemorySize : 6536220
OsFreeVirtualMemory : 5858416
OsInUseVirtualMemory : 677804
OsTotalSwapSpaceSize :
OsSizeStoredInPagingFiles : 1572864
OsFreeSpaceInPagingFiles : 1572864
OsPagingFiles : {C:\pagefile.sys}
OsHardwareAbstractionLayer : 10.0.16299.371
OsInstallDate : 28/4/2018 8:41:19 PM
OsManufacturer : Microsoft Corporation
OsMaxNumberOfProcesses : 4294967295
OsMaxProcessMemorySize : 137438953344
OsMuiLanguages : {en-US}
OsNumberOfLicensedUsers : 0
OsNumberOfProcesses : 66
OsNumberOfUsers : 2
OsOrganization :
OsArchitecture : 64-bit
OsLanguage : en-US
OsProductSuites : {TerminalServices, TerminalServicesSingleSession}
OsOtherTypeDescription :
OsPAEEnabled :
OsPortableOperatingSystem : False
OsPrimary : True
OsProductType : Server
OsRegisteredUser : Windows User
OsSerialNumber : 00395-60000-00001-AA842
OsServicePackMajorVersion : 0
OsServicePackMinorVersion : 0
OsStatus : OK
OsSuites : {TerminalServices, TerminalServicesSingleSession}
OsServerLevel : ServerCore
KeyboardLayout : en-US
TimeZone : (UTC+08:00) Kuala Lumpur, Singapore
LogonServer :
PowerPlatformRole : Desktop
HyperVisorPresent : True
HyperVRequirementDataExecutionPreventionAvailable :
HyperVRequirementSecondLevelAddressTranslation :
HyperVRequirementVirtualizationFirmwareEnabled :
HyperVRequirementVMMonitorModeExtensions :
DeviceGuardSmartStatus : Off
DeviceGuardRequiredSecurityProperties :
DeviceGuardAvailableSecurityProperties :
DeviceGuardSecurityServicesConfigured :
DeviceGuardSecurityServicesRunning :
DeviceGuardCodeIntegrityPolicyEnforcementStatus :
DeviceGuardUserModeCodeIntegrityPolicyEnforcementStatus :
Here is cmdlet to find the container cmdlet and result
Get-WindowsFeature -Name Containers
Display Name Name Install State
------------ ---- -------------
[X] Containers Containers Installed
Get-InstalledModule
Version Name Repository Description
------- ---- ---------- -----------
1.0.0.4 DockerMsftProvider PSGallery PowerShell module with commands for discovering,...
1.0.154 DockerPowershell PSGallery Adds cmdlets to work with the Docker cli.
get-command | where Source -EQ "*cont*"
Empty

Powershell not looping over all comobjects

I am traversing a webpage and I need the value from a specific 'td' tag:
$ie.Document.getElementsByTagName("td")
And I get this:
className :
id :
tagName : TD
parentElement : System.__ComObject
style : System.__ComObject
onhelp :
onclick :
ondblclick :
onkeydown :
onkeyup :
onkeypress :
onmouseout :
onmouseover :
onmousemove :
onmousedown :
onmouseup :
document : mshtml.HTMLDocumentClass
title :
language :
onselectstart :
sourceIndex : 121
recordNumber :
lang :
offsetLeft : 0
offsetTop : 32
offsetWidth : 42
offsetHeight : 32
offsetParent : System.__ComObject
innerHTML : <span title="" id="jobsForm:jobsTable:0:jobId">886</span>
innerText : 886
outerHTML : <td><span title="" id="jobsForm:jobsTable:0:jobId">886</span></td>
outerText : 886
parentTextEdit : System.__ComObject
isTextEdit : False
filters :
ondragstart :
onbeforeupdate :
onafterupdate :
onerrorupdate :
onrowexit :
onrowenter :
ondatasetchanged :
ondataavailable :
ondatasetcomplete :
onfilterchange :
children : System.__ComObject
all : System.__ComObject
scopeName : HTML
onlosecapture :
onscroll :
ondrag :
ondragend :
ondragenter :
ondragover :
ondragleave :
ondrop :
onbeforecut :
oncut :
onbeforecopy :
oncopy :
onbeforepaste :
onpaste :
currentStyle : System.__ComObject
onpropertychange :
tabIndex : 0
accessKey :
onblur :
onfocus :
onresize :
clientHeight : 31
clientWidth : 42
clientTop : 1
clientLeft : 0
readyState : complete
onreadystatechange :
onrowsdelete :
onrowsinserted :
oncellchange :
dir :
scrollHeight : 31
scrollWidth : 42
scrollTop : 0
scrollLeft : 0
oncontextmenu :
canHaveChildren : True
runtimeStyle : System.__ComObject
behaviorUrns : System.__ComObject
tagUrn :
onbeforeeditfocus :
isMultiLine : True
canHaveHTML : True
onlayoutcomplete :
onpage :
onbeforedeactivate :
contentEditable : inherit
isContentEditable : False
hideFocus : False
disabled : False
isDisabled : False
onmove :
oncontrolselect :
onresizestart :
onresizeend :
onmovestart :
onmoveend :
onmouseenter :
onmouseleave :
onactivate :
ondeactivate :
onmousewheel :
onbeforeactivate :
onfocusin :
onfocusout :
uniqueNumber : 13
uniqueID : ms__id13
nodeType : 1
parentNode : System.__ComObject
childNodes : System.__ComObject
attributes : System.__ComObject
nodeName : TD
nodeValue :
firstChild : System.__ComObject
lastChild : System.__ComObject
previousSibling :
nextSibling : System.__ComObject
ownerDocument : mshtml.HTMLDocumentClass
role :
ariaBusy :
ariaChecked :
ariaDisabled :
ariaExpanded :
ariaHaspopup :
ariaHidden :
ariaInvalid :
ariaMultiselectable :
ariaPressed :
ariaReadonly :
ariaRequired :
ariaSecret :
ariaSelected :
ie8_attributes :
ariaValuenow :
ariaPosinset :
ariaSetsize :
ariaLevel :
ariaValuemin :
ariaValuemax :
ariaControls :
ariaDescribedby :
ariaFlowto :
ariaLabelledby :
ariaActivedescendant :
ariaOwns :
ariaLive :
ariaRelevant :
ie9_tagName :
ie9_nodeName :
onabort :
oncanplay :
oncanplaythrough :
onchange :
ondurationchange :
onemptied :
onended :
onerror :
oninput :
onload :
onloadeddata :
onloadedmetadata :
onloadstart :
onpause :
onplay :
onplaying :
onprogress :
onratechange :
onreset :
onseeked :
onseeking :
onselect :
onstalled :
onsubmit :
onsuspend :
ontimeupdate :
onvolumechange :
onwaiting :
constructor : System.__ComObject
onmspointerdown :
onmspointermove :
onmspointerup :
onmspointerover :
onmspointerout :
onmspointercancel :
onmspointerhover :
onmslostpointercapture :
onmsgotpointercapture :
onmsgesturestart :
onmsgesturechange :
onmsgestureend :
onmsgesturehold :
onmsgesturetap :
onmsgesturedoubletap :
onmsinertiastart :
onmstransitionstart :
onmstransitionend :
onmsanimationstart :
onmsanimationend :
onmsanimationiteration :
oninvalid :
xmsAcceleratorKey :
spellcheck : True
onmsmanipulationstatechanged :
oncuechange :
rowSpan : 1
colSpan : 1
align :
vAlign :
bgColor :
noWrap : False
background :
borderColor :
borderColorLight :
borderColorDark :
width :
height :
cellIndex : 0
abbr :
axis :
ch :
chOff :
headers :
scope :
ie9_ch :
ie9_chOff :
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
System.__ComObject
There are 86 entries returned by that request. Whenever I try to iterate over the list, I get considerably fewer responses:
$ie.Document.getElementsByTagName("td") | foreach-object {write-output $_.tagName}
TD
TD
TD
TD
TD
TD
TD
TD
TD
TD
TD
TD
TD
TD
All 86 responses have a tagName of "TD" (they have to, that's a requirement for their return from the function call before). For some reason it's not looping over all the objects returned by the getElementsByTagName() call and I don't understand why. Am I missing something here? The response object if I store the query in a variable is itself a comobject so I don't know if there are special rules:
$whatpage = $ie.Document.getElementsByTagName("td")
$whatpage
System.__ComObject
edit: Here's the html from the page
http://pastebin.com/embed_js.php?i=qA9wJuBY
What you are getting as result is obvious behavior. If you observe the value for TagName property it is definitely going to be TD because you are getting the results from getElementsByTagName("td") method, so it is going to return all the elements where tag name is TD.
Now, if you are looking for values inside the tag (TD or table data) to return the values from the table cell then you should use $whatpage | %{$_.InnerText} or $ie.Document.getElementsByTagName("td") | foreach-object {write-output $_.InnerText}
Hope that helps!

Getting USB Version through WMI Classes

I am trying to query the USB Device for the USB Descriptor which will store information regarding the USB Version, Device ID, PID, VID etc. I only need the USB Version.
Here is the PowerShell Code so far:
[System.Reflection.Assembly]::Load("System.Management, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
$Man = New-Object System.Management.ManagementClass("Win32_USBHub")
[System.Management.ManagementObjectCollection]$Devs = $Man.GetInstances()
echo $Devs
The output I am getting is:
__GENUS : 2
__CLASS : Win32_USBHub
__SUPERCLASS : CIM_USBHub
__DYNASTY : CIM_ManagedSystemElement
__RELPATH : Win32_USBHub.DeviceID="USB\\VID_0781&PID_5567\\4C530000120619102080"
__PROPERTY_COUNT : 28
__DERIVATION : {CIM_USBHub, CIM_USBDevice, CIM_LogicalDevice, CIM_LogicalElement...}
__SERVER : APPS-SD-AUTO-PC
__NAMESPACE : root\cimv2
__PATH : \\APPS-SD-AUTO- PC\root\cimv2:Win32_USBHub.DeviceID="USB\\VID_0781&PID_5567\\4C530000120619102080"
Availability :
Caption : USB Mass Storage Device
ClassCode :
ConfigManagerErrorCode : 0
ConfigManagerUserConfig : False
CreationClassName : Win32_USBHub
CurrentAlternateSettings :
CurrentConfigValue :
Description : USB Mass Storage Device
DeviceID : USB\VID_0781&PID_5567\4C530000120619102080
ErrorCleared :
ErrorDescription :
GangSwitched :
InstallDate :
LastErrorCode :
Name : USB Mass Storage Device
NumberOfConfigs :
NumberOfPorts :
PNPDeviceID : USB\VID_0781&PID_5567\4C530000120619102080
PowerManagementCapabilities :
PowerManagementSupported :
ProtocolCode :
Status : OK
StatusInfo :
SubclassCode :
SystemCreationClassName : Win32_ComputerSystem
SystemName : APPS-SD-AUTO-PC
USBVersion :
Here USBVersion is coming as an empty field. Can anyone suggest a solution?
I have tried with Win32_usbDeviceController but that is also returning an empty field.