locked
How to code this powershell? RRS feed

  • Question

  • When I run following coding, it shows the Firefox browser, I would like to know on how to display different version of browser and different types of browsers, such as IE, Chrome, ...

    $userAgent = [Microsoft.PowerShell.Commands.PSUserAgent]::FireFox

    Does anyone have any suggestions?
    Thanks in advance for any suggestions


    Thanks in advance for any suggestions

    Tuesday, February 20, 2018 7:42 AM

Answers

  • [Microsoft.PowerShell.Commands.PSUserAgent]|gm -static

    [Microsoft.PowerShell.Commands.PSUserAgent]::Opera


    \_(ツ)_/


    • Edited by jrv Tuesday, February 20, 2018 8:11 AM
    • Marked as answer by oemMicrosoft Tuesday, February 20, 2018 10:39 PM
    Tuesday, February 20, 2018 8:09 AM
  • $ww.BaseResponse.Cookies = $null

    \_(ツ)_/

    • Marked as answer by oemMicrosoft Wednesday, February 21, 2018 3:20 PM
    Wednesday, February 21, 2018 3:11 PM

All replies

  • [Microsoft.PowerShell.Commands.PSUserAgent]|gm -static

    [Microsoft.PowerShell.Commands.PSUserAgent]::Opera


    \_(ツ)_/


    • Edited by jrv Tuesday, February 20, 2018 8:11 AM
    • Marked as answer by oemMicrosoft Tuesday, February 20, 2018 10:39 PM
    Tuesday, February 20, 2018 8:09 AM
  • Thank you very much for suggestions (^v^)

    Thanks in advance for any suggestions

    Tuesday, February 20, 2018 10:39 PM
  • [Microsoft.PowerShell.Commands.PSUserAgent]|gm -static

    [Microsoft.PowerShell.Commands.PSUserAgent]::Opera


    When the browser name is changed, does it retrieve cookies from changed browser as well?

    For example, when requesting a web connection using Opera, does it use cookies from Opera or IE?

    or it just change the display name of browser. If yes, does PowerShell retrieve cookies from IE browser by default?

    Do you have any suggestions?
    Thank you very much for any suggestions (^v^)


    Thanks in advance for any suggestions

    Wednesday, February 21, 2018 4:34 AM
  • You cannot use this to change browsers.  This just gives the browser ID header string that can be used with web requests.  It has nothing to do with browser programs.

    \_(ツ)_/

    Wednesday, February 21, 2018 5:34 AM
  • Whatever PowerShell make request for web connection, it always use IE as default and the IE browser cannot be changed, would it be correct?

    Do you have any suggestions?
    Thank you very much for any suggestions (^v^)


    Thanks in advance for any suggestions

    Wednesday, February 21, 2018 6:07 AM
  • PowerShell does not make web requests.  CmdLets can call a web site.  This is all done using the Net Framework API.  It does not use a browser.


    \_(ツ)_/

    Wednesday, February 21, 2018 6:15 AM
  • If web page would create cookies when visited, cookies cannot be created on using PowerShell - CmdLets - Net Framework API, would it be correct?

    Do you have any suggestions?
    Thank you very much for any suggestions (^v^)


    Thanks in advance for any suggestions

    Wednesday, February 21, 2018 8:27 AM
  • Without your code I see no way to answer your question.


    \_(ツ)_/

    Wednesday, February 21, 2018 8:55 AM
  • Referring to following coding, I would like to know on where the cookies store.

    $ww = Invoke-WebRequest http://www.google.com
    $ww.BaseResponse.Cookies

    Do you have any suggestions?
    Thank you very much for any suggestions (^v^)


    Thanks in advance for any suggestions

    Wednesday, February 21, 2018 11:14 AM
  • In the cookie jar.  Where else would they be?

    \_(ツ)_/

    Wednesday, February 21, 2018 11:16 AM
  • I would like to know on how to clean this cookies jar using PowerShell scripts

    Furthermore, when will this cookies expired by default?

    Do you have any suggestions?
    Thank you very much for any suggestions (^v^)


    Thanks in advance for any suggestions



    • Edited by oemMicrosoft Wednesday, February 21, 2018 12:21 PM
    Wednesday, February 21, 2018 12:20 PM
  • Don't take the bait jrv.

    -- Bill Stewart [Bill_Stewart]

    Wednesday, February 21, 2018 2:13 PM
  • Don't take the bait jrv.

    Could you please describe more on how to clean this cookies jar using PowerShell scripts?

    Do you have any suggestions?
    Thanks, to everyone very much for any suggestions (^v^)


    Thanks in advance for any suggestions

    Wednesday, February 21, 2018 2:44 PM
  • $ww.BaseResponse.Cookies = $null

    \_(ツ)_/

    • Marked as answer by oemMicrosoft Wednesday, February 21, 2018 3:20 PM
    Wednesday, February 21, 2018 3:11 PM
  • Thank you very much for any suggestions (^v^)

    Thanks in advance for any suggestions

    Wednesday, February 21, 2018 3:20 PM
  • $ww.BaseResponse.Cookies = $null

    If $ww is defined in this way and execute Invoke-WebRequest, when I recall cookies, it shows nothing.

    $ww = "http://www.google.com"
    (Invoke-WebRequest -Uri $ww -SessionVariable Y -UseBasicParsing).Content | Out-File -FilePath C:\TEMP.txt
    $ww.baseresponse.cookies, which show nothing

    I would like to know on what variable stores cookies under this situation on above statement.

    Do you have any suggestions?
    Thanks, to everyone very much for any suggestions (^v^)


    Thanks in advance for any suggestions

    Wednesday, February 21, 2018 3:38 PM
  • You need to learn how to use online documentation instead of asking others to look up everything for you.  You need to alos learn how to use PowerSHell to discover object properties and methods.

    https://docs.microsoft.com/en-us/dotnet/api/microsoft.powershell.commands.webrequestsession?view=pscore-6.0.0


    \_(ツ)_/

    Wednesday, February 21, 2018 3:44 PM
  • oem7110 - what jrv said is correct. You ask lots of very basic questions and seem to be unwilling to look up answers on your own. This forum does not exist as your personal research assistant. Please read the following:



    -- Bill Stewart [Bill_Stewart]

    Wednesday, February 21, 2018 3:53 PM