Im trying to iterate through multiple HTML files in multiple computers.
My code is below:
ForEach ($system in (Get-Content C:\temp\computers.txt)) {
$folder = "\\$system\c`$\ProgramData\Autodesk\AdLM\"
Get-ChildItem $folder *.html |
Foreach-Object {
$c = $_.BaseName
$html = New-Object -ComObject "HTMLFile"
$HTML.IHTMLDocument2_write($(Get-content $_.Name -Raw ))
$para1 = $HTML.getElementById('para1') | % InnerText
Add-Content -path c:\temp\results.csv "$c,$system,$para1"
}
}
I'm getting the following error:
New-Object : Cannot find parameter Raw
New-Objectcmdlet is a built-in PowerShell cmdlet. The querent should look at gallery.technet.microsoft.com/Powershell-Tip-Parsing-49eb8810 for handling HTML files using the Document Object Model.