Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- If( -Not $(Test-Path 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3')) {
- New-ItemProperty -Path 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3' -Name '1A10' -value '0' -PropertyType "DWORD" | Out-Null
- }
- Else {
- Set-ItemProperty -Path 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3' -Name '1A10' -value '0' | Out-Null
- }
- $WebResponse = Invoke-WebRequest "https://www.dell.com/support/kbdoc/fr-fr/000109893/packs-de-pilotes-dell-command-deploy-pour-mod%C3%A8les-latitude"
- $counter = 0
- $WebResponse.AllElements | Where {$_.TagName -eq "td"} | Foreach {
- If ($counter -eq 0 -Or ($counter % 4) -eq 0) {
- $Label = $_.innerHTML.Replace("<div>","")
- $Label = $Label.Replace("</div>","")
- $Label = $Label.Replace("<br>","")
- $Label = $Label.Replace(" "," ")
- $Label = $Label -replace '<[^>]+>','' #remove HTML code
- $Label = $Label -replace '(^\s+|\s+$)','' -replace '\s+',' ' #remove all spaces at the beginning and end of the line
- }
- ElseIf ($counter -eq 1 -Or ($counter % 4) -eq 1) {
- $URL = $_.innerHTML
- $URL = $URL -replace '<[^>]>',''
- $URL = ((Select-String '(http[s]?)(:\/\/)([^\s,]+)(?=")' -Input $URL).Matches.Value)
- (Invoke-WebRequest -Uri $URL).Links.Href | Sort-Object | Get-Unique | Foreach {
- If ($_ -Like "*.CAB*") {
- $DirectURL = $_
- }
- }
- }
- ElseIf ($counter -eq 2 -Or ($counter % 4) -eq 2) {
- $Version = $_.innerText
- $Version = $Version -replace '<[^>]+>',''
- $Version = $Version -replace '(^\s+|\s+$)','' -replace '\s+',' '
- }
- ElseIf ($counter -eq 3 -Or ($counter % 4) -eq 3) {
- Write-Host $Label " " $Version " " $DirectURL
- }
- $counter++
- }
- Remove-ItemProperty -Path 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3' -Name '1A10'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement