Powershell - Run as another user account

227 views
Skip to first unread message

Jeff Picklyk

unread,
Oct 28, 2014, 11:48:21 AM10/28/14
to puppet...@googlegroups.com
Hello everyone,

What is the suggested way with Puppet 3.7.x of running a powershell command under another user's context?

I see that exec has a group and user parameter but I can't find documentation on how this relates to windows and specifically powershell commands.  It would be nice if I could just provide a PSCredential as an argument and powershell module just deal with it for me.

Ideas?

Thanks,

Jeff

Victor Danilchenko

unread,
Oct 28, 2014, 3:28:00 PM10/28/14
to puppet...@googlegroups.com
Is 'runas' Windows command what you are looking for?

Rob Reynolds

unread,
Oct 28, 2014, 3:39:53 PM10/28/14
to puppet...@googlegroups.com
Hi Jeff,
 You will likely want to watch PUP-532[1] as it addresses adding the runas for exec on Windows. This is something that is not likely to come out until Puppet 4 or later. It is something that is high on our priority list though, so I'd think we'll see it earlier in the 4.x series.

If you need something sooner, you might be able to make a custom provider for exec that could perform what is needed. Password would likely need to be added to the type, so that makes it a bit more challenging.

 

Thanks,

Jeff

--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/5d210cb3-6c95-4ead-8791-80b1ceea81f0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Rob Reynolds
Developer, Puppet Labs

Join us at PuppetConf 2015, October 5-9 in Portland, OR - http://2015.puppetconf.com/
Register early to save 40%!

Jeff Picklyk

unread,
Oct 28, 2014, 4:16:20 PM10/28/14
to puppet...@googlegroups.com
Yes unfortunately this feature enhancement is pretty much what I'm looking for.  I was looking at the puppetlabs\powershell provider to see if I could easily fork it and patch it with what I need, but I'm not too familiar with coding providers.  I'm pretty novice with Puppet still.

I'm going to try to use Invoke-Command which allows for PSCredentials to be passed as is documented here: http://matthewyarlett.blogspot.com/2014/04/powershell-runas.html
Reply all
Reply to author
Forward
0 new messages