From the course: Complete Guide to PowerShell 7

Unlock this course with a free trial

Join today to access over 24,400 courses taught by industry experts.

Managing credentials securely

Managing credentials securely - PowerShell Tutorial

From the course: Complete Guide to PowerShell 7

Managing credentials securely

- [Instructor] So we've touched on this before, but storing credentials, it's quite an important part within PowerShell. Now of course we have our simple example here where we choose to create the credentials. So let me just create my single account here like so. And then of course we go through the same process of storing the credential into an XML file, and then of course going through the process of retrieving those credentials like so. And then obviously we can retrieve things like the username or we can reuse the credentials in other parts of the code. That works really, really well. However, what we can do is obviously prompt the end user. So instead of actually writing something down, we can say well, can you type something as a secure string and send it back? So let's go through this process. So SecurePassword is the variable. We're going to use what's called Read-Host to prompt the end user to type something in. So let's say Run Selection, enter password. Okay, so now we have…

Contents