Powershell Enter-PSSession use current credential

I want to use Windows Powershell to start up a VirtualBox VM and then Enter-PSSession to manage the machine on an automated nightly system, which means I will be asleep when this is happening and not able to enter in a password.

I have two choices as far as I know: 1. Use the current credentials, as these are on a domain that the VM accepts credentials from. 2. Hardcode in my credentials (probably the same as the current credentials)

I do not like option 2 as I have been tasked with the avoidance of hardcoded credentials where possible, but I do not know whether option 1 is possible. How would you solve this problem?

1 Answer

For Enter-PSSession cmdlet "-Credential" is not a mandatory parameter. So if you don't specify credential, your current credential will be used.

2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like