Getting started with 1Password for your growing team, or refining your setup? Our Secured Success quickstart guide is for you.
Forum Discussion
Former Member
3 years agoPowershell , CLIv2: Need to automate login with hard coded password
Hello!
I'm working on a project where I am using PowerShell running a PowerShell script on Windows 11. I need to use the CLI to automatically login with the password with no user interaction. This ...
Former Member
3 years agoOk. I came across something that cleared this up.
Make one script file (test.ps1) containing this:
$wshell = New-Object -ComObject wscript.shell;
$wshell.AppActivate('Your Title')
Sleep 4
$wshell.SendKeys('password1234')
$wshell.SendKeys('~')
Then make another script file(test2.ps1) containing whatever you need the password for and whatever you want to accomplish:
Invoke-Expression $(op signin)
Then put this into the PS prompt:
.\Test.ps1; .\Test2.ps1
And Bob's your uncle, you're done.