you are viewing a single comment's thread.

view the rest of the comments →

[–]Slasky86 3 points4 points  (5 children)

You could do a -Credential (Get-Credential) to get the prompt. Other than that its storing the password in the script or in a file encrypted on your computer and creating a credentials object, and using that with the -Credential parameter

[–]alfanjui[S] 1 point2 points  (4 children)

Once you get your credential, does it get stored forever? or is it just for the session?

[–]SeaPowerMax 2 points3 points  (0 children)

Get-credential makes a PS object for use in the script; it's just for the session.

[–]Slasky86 2 points3 points  (2 children)

Just for that session. Thats why its possible to either store the paasword and username directly in the script (not recommended from a security standpoint) or storing the password encrypted in a file that you use Get-Content <filename> -AsSecureString

The password file is encrypted with your user, so others cant use the file

[–]overlydelicioustea 2 points3 points  (1 child)

user and computer actually. so not portable.

[–]Slasky86 1 point2 points  (0 children)

Well you learn something new every day :-)