Exporting credentials in XML

Working as a consultant, from time to time you receive some petitions from your customers in order to facilitate their daily lives.

The other day I receive a petition to save user credentials, and to not prompt for them, is it very easy to do it, lets crack into it:

#Save credentials to file

Get-Credential | Export-Clixml -Path C:\aar\credentials.xml

#Import credentials from file

$credentials = Import-Clixml -Path c:\aar\credentials.xml

Once you have done this, you can include this last line into your scripts pointing to the location where you stored the credentials. Simply as follows:

azuread.png

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s