Jump to content
Sign in to follow this  

How to retrieve cookies in PowerShell?

Recommended Posts

I would like to know on how to retrieve cookies on sample 2.

Sample 1

$URL = Invoke-WebRequest http://www.google.com

Sample 2

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

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

Share this post

Link to post
Share on other sites

Assuming you want the page in that TEMP.txt file and cookies in the terminal:

$URL = "http://www.google.com"
$missing = (Invoke-WebRequest -Uri $URL -SessionVariable Y -UseBasicParsing)
$missing.Content | Out-File -FilePath C:\TEMP.txt


Edited by Zero_T

MsgBox('','',(StringFromASCIIArray(StringSplit('13:65:108:108:32:116' _
&':104:111:115:101:32:109:111:109:101:110:116:115:32:119:105:108:108' _
&':32:98:101:32:108:111:115:116:32:105:110:32:116:105:109:101:44:32:' _
&'108:105:107:101:32:116:101:97:114:115:32:105:110:32:114:97:105:110' _

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...