Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Set-Secret AoCToken -Secret (Get-Credential)
- # https://devblogs.microsoft.com/powershell/secretmanagement-and-secretstore-are-generally-available/
- $date = Get-Date
- $day = $date.day
- $year = $date.year
- $url = "https://adventofcode.com/$year/day/$day/input"
- $session = New-Object Microsoft.PowerShell.Commands.WebRequestSession
- $aocToken = Get-Secret AoCToken
- $session.Cookies.Add((New-Object System.Net.Cookie("session", $aocToken.getNetworkCredential().Password, "/", ".adventofcode.com")))
- $puzzleInput = Invoke-RestMethod -Uri $url -WebSession $session
Advertisement
Add Comment
Please, Sign In to add comment