I am passing the username using the script, but for the password part, i want to do that interactively, once the password is entered by the user then the script should proceed with next steps. I am using the below script, once username is populated in the website then sleep for 2 mins after that click on login. But its not working, its not coming out of sleep. Kindly let me know if i miss anything or any other alternative option
# Open all websites
# Script to wait till webpage is downloaded into the browsers.
# Feed in your credentials to the input fields on the web page
My advice is to get the information at the start of the script. Adding a param() block at the beginning of your script to prompt for username and password would do the trick. The advantage is that users could store the credentials securely in an encrypted form on disk and reuse while passing the Credential parameter.
param ( [Parameter(Mandatory)] [System.Management.Automation.CredentialAttribute()] [PSCredential] $Credential ) # ... # Access the credential details provided $Credential.UserName $Credential.GetNetworkCredential().Password # ...
Thanks for the reply.
I am new to Powershell, Could you please help me on this.
I am able to do it using the below, please confirm if it is a secure way or not?
#$SecureString = Read-Host -AsSecureString
$EncryptedPW = Get-Content -Path "C:\mypw.txt"
You must be logged in to reply to this topic.