Start a program with other user

by edtjbre at 2012-09-10 05:09:37

Hi all!

i´m new to scripting and im trying to get to grips with something that bugs me… every time i restart my computer at work i have to start up a boatload of programs that all ask for my "admin" account (vSphere is one)

so i finally thought that since im trying to learn powershell, why not try to do this in powershell!

the problem is that the company i work for has a really anoying smartcard "PKI" solution in place, so its not just an AD user i have to login with…

the windows command "runas" can handle this with the /smartcard switch but i dont fancy typing the same password a boatload of times…

im reading up om get-credentials but i dont understand how to get it to work with the smartcard, and how do i start programX.exe with the credentials obtained from get-credentials

at this time, i dont have alot of code to share…

seems it is hard to learn how to swim in the deep end of the pool!

any ideas?
by coderaven at 2012-09-10 06:25:52
In the past few years, running Windows 7, I always start a PowerShell session as my administrative user because I know I am going to need it. Once I have that started, I know I will need Group Policy management open, Printer Management open, and of course Active Directory Administrative Center. Once the PowerShell session it open, it is already authenticated as my admin user so I just run, gpmc.msc for group policy, printmanagement.msc for print management and dsac.exe to open the ADAC. Nothing special really needed, other than opening your initial PowerShell session with a password. I will look into storing a password for a smartcard, I am not familiar with that.

In Windows 8, if you have Server manager open, it will allow you to open the other administrative tools from the tools menu without authenticating again.
by DonJ at 2012-09-10 06:55:56
Get-Credential will work with a smart card, although because of the way smart cards work, you’d need to leave it inserted of the duration of the credential object’s lifespan.

A discussion on just this topic:
http://social.technet.microsoft.com/For … 6c239b8541

The deep end is definitely harder for swimming, but it’s the only way to win gold medals ;).