Secure Store
1 TopicInvoke-Webrequest using secure string
Hello everyone, here is my question, I can't find anything online nor will AI help me (Might be my fault tho) So I want to use some Invoke-Webrequest cmdlts, but I first have to login to the website. I tried it with PLAIN Credentials, everything is working like expected. But now I have to get the script working with a Secure String password (and a SecretVault for stored Creds but thats not the Problem right now) The Webpage is reading the Secure String literal so it obviously wont accept my pw. Is there a way to format the String so im able to correctly pass it to the webpage? I know i can make it plain but thats obviously not what i want. Maybe there is a compromise? The request has to be POST Or maybe there is even a way to properly imbed the Secure String so its readable for the webpage(?) #This is not the acutal script im working on but a mini version on a test site, the $dbForm.Action is probably not working but it doesnt matter here $r = Invoke-WebRequest -uri "https://keepass.info/help/kb/testform.html" -SessionVariable ses $dbForm = $r.Forms.Fields $dbForm["LoginFormUser"] = "testuser" #Note that i want this to be a Secure String but as of right now this only works plain 😞 $password = "PlainPW" $dbForm["pwd"] = $password $r1 = Invoke-WebRequest -uri ("https://keepass.info/help/kb/testform.html" + $dbForm.Action) -WebSession $ses -UseBasicParsing -Method Post -Body $dbForm I will successfully login using the plain PW (again, it wont work with a secure string) and can now crawl. Please suggest anything that comes to your mind 🙂1.2KViews0likes2Comments