Can you encrypt a password directly into a powershell script

Afternoon all,

Can you encrypt a password directly into a PowerShell script and then send that script to someone else for them to run it, so it'll then use your rights in order to run WITHOUT putting the password in on their machine?

I've looked and can't get a clear answer, I'm guessing the answer is no.

Regards
Alex
LVL 18
Alex GreenProject Systems EngineerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Éric MoreauSenior .Net ConsultantCommented:
I am using a technique so save credentials for jobs running on a server. Have a look at http://emoreau.com/Entries/Articles/2016/11/PowerShell-Get-O365-mailboxes-statistics.aspx and do not forget to read the comment at the bottom of the article.
0
ste5anSenior DeveloperCommented:
Sure, you can. But it is not safe (very secure).

What is you use-case?
0
Alex GreenProject Systems EngineerAuthor Commented:
Is it easily crackable then if I store the password in there?

Thanks
Alex
0
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Éric MoreauSenior .Net ConsultantCommented:
everything is crackable in the hands of somebody who really wants to access it. I would be more worried about the "someone else" reusing the credentials file for something else!
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Alex GreenProject Systems EngineerAuthor Commented:
good point well presented.

Thank you
0
Alex GreenProject Systems EngineerAuthor Commented:
thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Powershell

From novice to tech pro — start learning today.