1

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?

4

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

  • Yeah, I tried that before and it didn't work, but that's because I was logged on as a different user than I intended to be. Managing a desktop is hard enough without a remote desktop inside that and a virtual machine inside the remote desktop... Ok, thanks for prompting me to try this again. – Void Star Aug 4 '15 at 21:42
  • 1
    Also you have to use New-PSSession in a script, Enter-PSSession is for interactive remote session. – Void Star Aug 4 '15 at 21:49

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.