here is my question, I cant 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
Dominik Sommer is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.