Powershell not looping over all comobjects - powershell

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!

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.

Gatling Time Extraction From Response Body

I am completely new to Gatling/Scala.
I have a scenario to execute. Here it goes:
-->Change the shift timings of the employees.
For the above, I am able to script/code the flow. However, I have a challenge:
-> I need to extract the "new" time values from the response and check if that matches with the "new" time values being passed through the parameter (csv) file.
Approach/logic: Extract the date values from the response body and compare that with the date value that has been provided in the csv file.
Sample Response:
{
"employeeId":"xxxxxx",
"schedules":
[
{
"date":"2019-11-25",
: : : "schedules":
: : : [
: : : : {
: : : : : "employeeId":"xxxxxx",
: : : : : "laborWeekStartDate":"2019-11-25", //New edited time
: : : : : "laborWeekEndDate":"2019-12-01", //New edited time
: : : : : "schedules":
: : : : : {
: : : : : : "startTime":"2019-11-25T18:15:00.000Z",
: : : : : : "endTime":"2019-11-25T23:45:00.000Z",
: : : : : : "departmentId":xxxxx,
: : : : : : "departmentName":"abc",
: : : : : : "lastModifiedTimestamp":"2019-12-11T09:22:44.000Z",
: : : : : : "breakDetails":
: : : : : : [
: : : : : : : {
: : : : : : : : "startTime":"2019-11-25T21:00:00.000Z",
: : : : : : : : "endTime":"2019-11-25T21:15:00.000Z",
: : : : : : : : "type":"break"
: : : : : : : }
: : : : : : ]
: : : : : }
: : : : }
: : : ]
: : }
Here, in the below, the right-handside values need to be extracted and compared with the values provided in the csv file.
"startTime":"2019-11-25T18:15:00.000Z",
"endTime":"2019-11-25T23:45:00.000Z",
Please help in performing the above. A step-wise detailed explanation would be much appreciated considering I am totally new to this.
Thanks!
Disclaimer: I will provide some useful links that should help you in achieving the task. If you will encounter any problems doing it, just post a new question
In order to get a value from a JSON response, you could use a jsonPath HTTP response body. There is an example here, how value can be extracted and saved using this method :JSON Path Usage for Gatling Tests
Reading values from CSV file is possible using a built-in feeder functionality: CSV feeders .Once you have the feeder added, you can reference a value using ${columnName} There is an example here: Step 03: Use dynamic data with Feeders and Checks.
After this step you have both values in session. Then using scala language, you should be able to compare those values. Getting a value from session happens using session("variableName").as[String]
For example, you could do a String comparision, if you first substring the value from csv. Scala String comparision Another option is like described here, which is really close to your requirement : How to compare responses from http calls in gatling?
Good luck! :)

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 }

Duplex WIA scan properties missing

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
}

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