Voici un petit bout de code pour choisir quel navigateur utiliser lorsque vous lancez la commande Invoke-WebRequest.
$userAgent = [Microsoft.PowerShell.Commands.PSUserAgent]::Chrome Invoke-WebRequest http://powershellmagazine.com -UserAgent $userAgent
et voici le code qui liste toutes vos instances de navigateur installées :
[Microsoft.PowerShell.Commands.PSUserAgent].GetProperties() | Select-Object Name, @{n='UserAgent';e={ [Microsoft.PowerShell.Commands.PSUserAgent]::$($_.Name) }}
Name*
Email*
Website
Submit Comment
Δ
Code Anti-spam *