Answered by:
Parsing HTML web content and make object's with powershell

Question
-
Hello,
Firstly get content from web with :
Table = ((((@($Web.ParsedHtml.getElementsByTagName("table")) | select-Object -ExpandProperty innerText).trim()).replace(" ","")).Insert(7,' ')).Insert(14,' ').Insert(21, ' ').Insert(37, ' ').Insert(45,' ').Insert(48, '') | ConvertFrom-String | fl
Results:
It seems with object's
P1 : Denmark
P2 : Sweden
P3 : Norway
P4 : NorthernIreland
P5 : Finland
P6 : Lithuania
P7 : server2server6
P8 : blet1Why Im not able to get object P8 properties? its empty? it should be workstation number blet1?
$table | select-Object P8P8
----???? empty
- Edited by TechSpark0 Thursday, December 14, 2017 7:27 AM add
Wednesday, December 13, 2017 11:02 AM
Answers
-
Hi,
If possible, please post the html file in our forum directly so that we can do further analysis based on the issue.
Also, ".Insert(48, '')" less a space?
If you need further help, please feel free to let us know.
Best Regards,
AlbertPlease remember to mark the replies as an answers if they help.
If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com- Marked as answer by TechSpark0 Thursday, December 21, 2017 12:31 PM
Thursday, December 14, 2017 1:51 AM -
Have you tried Invoke-RestMethod with the website?
- Marked as answer by TechSpark0 Thursday, December 21, 2017 12:31 PM
Thursday, December 14, 2017 2:40 AM
All replies
-
Hi,
If possible, please post the html file in our forum directly so that we can do further analysis based on the issue.
Also, ".Insert(48, '')" less a space?
If you need further help, please feel free to let us know.
Best Regards,
AlbertPlease remember to mark the replies as an answers if they help.
If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com- Marked as answer by TechSpark0 Thursday, December 21, 2017 12:31 PM
Thursday, December 14, 2017 1:51 AM -
Have you tried Invoke-RestMethod with the website?
- Marked as answer by TechSpark0 Thursday, December 21, 2017 12:31 PM
Thursday, December 14, 2017 2:40 AM -
Hello,
Firstly get content from web with :
Table = ((((@($Web.ParsedHtml.getElementsByTagName("table")) | select-Object -ExpandProperty innerText).trim()).replace(" ","")).Insert(7,' ')).Insert(14,' ').Insert(21, ' ').Insert(37, ' ').Insert(45,' ').Insert(48, '') | ConvertFrom-String | fl
Results:
It seems with object's
P1 : Denmark
P2 : Sweden
P3 : Norway
P4 : NorthernIreland
P5 : Finland
P6 : Lithuania
P7 : server2server6
P8 : blet1Why Im not able to get object P8 properties? its empty? it should be workstation number blet1?
$table | select-Object P8P8
----???? empty
sorry, found answer by my selftThursday, December 21, 2017 12:31 PM