en-us/PSJsonCredential-help.xml

<?xml version="1.0" encoding="utf-8"?>
<helpItems schema="maml">
<command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp">
<command:details><command:name>Export-PSCredentialToJson</command:name>
<command:verb>Export</command:verb>
<command:noun>PSCredentialToJson</command:noun>
<maml:description><maml:para>Export a PSCredential to a JSON file
</maml:para>
</maml:description>
</command:details>
<maml:description><maml:para>This command will take a PSCredential object and export it to a JSON file. The password will be converted from a secure string using native Windows crypto APIs. The converted password can only be re-converted on the original computer. The export process will also capture metadata information including the credential of the user who ran the export and the computername.
</maml:para>
<maml:para>The user name will still be in plain text so you should take the necessary steps to safeguard this file.
</maml:para>
<maml:para>NOTE: Storing any sort of credential to disk is a potential security risk and may not be approved in every organization. Use with caution and at your own risk.
</maml:para>
</maml:description>
<command:syntax><command:syntaxItem><maml:name>Export-PSCredentialToJson</maml:name>
<command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none"><maml:name>Path</maml:name>
<maml:Description><maml:para>Enter the name and path for the JSON file.
</maml:para>
</maml:Description>
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
<dev:type><maml:name>String</maml:name>
<maml:uri /></dev:type>
<dev:defaultValue>None</dev:defaultValue>
</command:parameter>
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"><maml:name>Confirm</maml:name>
<maml:Description><maml:para>Prompts you for confirmation before running the cmdlet.
</maml:para>
</maml:Description>
<dev:type><maml:name>SwitchParameter</maml:name>
<maml:uri /></dev:type>
<dev:defaultValue>False</dev:defaultValue>
</command:parameter>
<command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="named" aliases="none"><maml:name>Credential</maml:name>
<maml:Description><maml:para>A PSCredential object
</maml:para>
</maml:Description>
<command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue>
<dev:type><maml:name>PSCredential</maml:name>
<maml:uri /></dev:type>
<dev:defaultValue>None</dev:defaultValue>
</command:parameter>
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"><maml:name>NoClobber</maml:name>
<maml:Description><maml:para>Do not overwrite an existing file.
</maml:para>
</maml:Description>
<dev:type><maml:name>SwitchParameter</maml:name>
<maml:uri /></dev:type>
<dev:defaultValue>False</dev:defaultValue>
</command:parameter>
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"><maml:name>Passthru</maml:name>
<maml:Description><maml:para>Display the json file object.
</maml:para>
</maml:Description>
<dev:type><maml:name>SwitchParameter</maml:name>
<maml:uri /></dev:type>
<dev:defaultValue>False</dev:defaultValue>
</command:parameter>
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"><maml:name>WhatIf</maml:name>
<maml:Description><maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.
</maml:para>
</maml:Description>
<dev:type><maml:name>SwitchParameter</maml:name>
<maml:uri /></dev:type>
<dev:defaultValue>False</dev:defaultValue>
</command:parameter>
</command:syntaxItem>
</command:syntax>
<command:parameters><command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"><maml:name>Confirm</maml:name>
<maml:Description><maml:para>Prompts you for confirmation before running the cmdlet.
</maml:para>
</maml:Description>
<command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue>
<dev:type><maml:name>SwitchParameter</maml:name>
<maml:uri /></dev:type>
<dev:defaultValue>False</dev:defaultValue>
</command:parameter>
<command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="named" aliases="none"><maml:name>Credential</maml:name>
<maml:Description><maml:para>A PSCredential object
</maml:para>
</maml:Description>
<command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue>
<dev:type><maml:name>PSCredential</maml:name>
<maml:uri /></dev:type>
<dev:defaultValue>None</dev:defaultValue>
</command:parameter>
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"><maml:name>NoClobber</maml:name>
<maml:Description><maml:para>Do not overwrite an existing file.
</maml:para>
</maml:Description>
<command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue>
<dev:type><maml:name>SwitchParameter</maml:name>
<maml:uri /></dev:type>
<dev:defaultValue>False</dev:defaultValue>
</command:parameter>
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"><maml:name>Passthru</maml:name>
<maml:Description><maml:para>Display the json file object.
</maml:para>
</maml:Description>
<command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue>
<dev:type><maml:name>SwitchParameter</maml:name>
<maml:uri /></dev:type>
<dev:defaultValue>False</dev:defaultValue>
</command:parameter>
<command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none"><maml:name>Path</maml:name>
<maml:Description><maml:para>Enter the name and path for the JSON file.
</maml:para>
</maml:Description>
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
<dev:type><maml:name>String</maml:name>
<maml:uri /></dev:type>
<dev:defaultValue>None</dev:defaultValue>
</command:parameter>
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"><maml:name>WhatIf</maml:name>
<maml:Description><maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.
</maml:para>
</maml:Description>
<command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue>
<dev:type><maml:name>SwitchParameter</maml:name>
<maml:uri /></dev:type>
<dev:defaultValue>False</dev:defaultValue>
</command:parameter>
</command:parameters>
<command:inputTypes><command:inputType><dev:type><maml:name>System.Management.Automation.PSCredential</maml:name>
</dev:type>
<maml:description><maml:para>
</maml:para>
</maml:description>
</command:inputType>
</command:inputTypes>
<command:returnValues><command:returnValue><dev:type><maml:name>System.Object</maml:name>
</dev:type>
<maml:description><maml:para>
</maml:para>
</maml:description>
</command:returnValue>
</command:returnValues>
<maml:alertSet><maml:alert><maml:para>v1.0.0
</maml:para>
<maml:para>Learn more about PowerShell: http://jdhitsolutions.com/blog/essential-powershell-resources/
</maml:para>
</maml:alert>
</maml:alertSet>
<command:examples><command:example><maml:title>Example 1</maml:title>
<dev:code>PS C:\&gt; Export-PSCredentialToJson -path c:\scripts\admin.json -credential "company\administrator"</dev:code>
<dev:remarks><maml:para>Create a json file in the Scripts folder for the company\administrator credential. You will be prompted for the password.
</maml:para>
</dev:remarks>
</command:example>
<command:example><maml:title>Example 2</maml:title>
<dev:code>PS C:\&gt; $cred | Export-PSCredentialToJson -path c:\scripts\mycred.json</dev:code>
<dev:remarks><maml:para>Pipe a previously created PSCredential to the export command.
</maml:para>
</dev:remarks>
</command:example>
</command:examples>
<command:relatedLinks><maml:navigationLink><maml:linkText>Get-Credential</maml:linkText>
<maml:uri></maml:uri>
</maml:navigationLink>
<maml:navigationLink><maml:linkText>ConvertFrom-SecureString</maml:linkText>
<maml:uri></maml:uri>
</maml:navigationLink>
<maml:navigationLink><maml:linkText>Import-PSCredentialFromJson</maml:linkText>
<maml:uri></maml:uri>
</maml:navigationLink>
<maml:navigationLink><maml:linkText>Get-PSCredentialFromJson</maml:linkText>
<maml:uri></maml:uri>
</maml:navigationLink>
</command:relatedLinks>
</command:command>
<command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp">
<command:details><command:name>Get-PSCredentialFromJson</command:name>
<command:verb>Get</command:verb>
<command:noun>PSCredentialFromJson</command:noun>
<maml:description><maml:para>Get stored credential information from a JSON file.
</maml:para>
</maml:description>
</command:details>
<maml:description><maml:para>This command will retrieve credential information from a JSON file created with Export-PSCredentialToJSON. The command will not convert the password but it will include the export metadata.
</maml:para>
</maml:description>
<command:syntax><command:syntaxItem><maml:name>Get-PSCredentialFromJson</maml:name>
<command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="0" aliases="none"><maml:name>Path</maml:name>
<maml:Description><maml:para>Enter the name of a json file
</maml:para>
</maml:Description>
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
<dev:type><maml:name>String</maml:name>
<maml:uri /></dev:type>
<dev:defaultValue>None</dev:defaultValue>
</command:parameter>
</command:syntaxItem>
</command:syntax>
<command:parameters><command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="0" aliases="none"><maml:name>Path</maml:name>
<maml:Description><maml:para>Enter the name of a json file
</maml:para>
</maml:Description>
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
<dev:type><maml:name>String</maml:name>
<maml:uri /></dev:type>
<dev:defaultValue>None</dev:defaultValue>
</command:parameter>
</command:parameters>
<command:inputTypes><command:inputType><dev:type><maml:name>System.String</maml:name>
</dev:type>
<maml:description><maml:para>
</maml:para>
</maml:description>
</command:inputType>
</command:inputTypes>
<command:returnValues><command:returnValue><dev:type><maml:name>System.Object</maml:name>
</dev:type>
<maml:description><maml:para>
</maml:para>
</maml:description>
</command:returnValue>
</command:returnValues>
<maml:alertSet><maml:alert><maml:para>v1.0.0
</maml:para>
<maml:para>Learn more about PowerShell: http://jdhitsolutions.com/blog/essential-powershell-resources/
</maml:para>
</maml:alert>
</maml:alertSet>
<command:examples><command:example><maml:title>Example 1</maml:title>
<dev:code>PS C:\&gt; Get-PSCredentialFromJson -path c:\scripts\admin.json
 
UserName : company\administrator
Password : 01000000d08c9ddf0115d1118c7a00c04fc297eb010000001368e9622137b247acf0b7a1a65648c8000000
                 000200000000001066000000010000200000007181f5ee0303464ac7ed8a906c17245830d8862106e94a43
                 b4a335785271c125000000000e800000000200002000000087b3353dd8210916153b1bd1ea0f6062a708b4
                 6f390dfa1e21ddc2db2874a4d920000000b9908f326ae33612af4ddb3e354dd379e813f238a9a29d989a26
                 cf89cb76ff2140000000221703208eab03d90020187b9b49467c071ccb51e531e6b311b31b576b95da4754
                 91e3b0e3a7929883b8cf658adaae2a9317105be5b733ee92981b81af011997
ExportDate : 12/24/2016 11:01:14 AM
ExportUser : Desk01\Jeff
ExportComputer : DESK01</dev:code>
<dev:remarks><maml:para>
</maml:para>
</dev:remarks>
</command:example>
</command:examples>
<command:relatedLinks><maml:navigationLink><maml:linkText>Get-Credential</maml:linkText>
<maml:uri></maml:uri>
</maml:navigationLink>
<maml:navigationLink><maml:linkText>ConvertFrom-SecureString</maml:linkText>
<maml:uri></maml:uri>
</maml:navigationLink>
<maml:navigationLink><maml:linkText>Import-PSCredentialFromJson</maml:linkText>
<maml:uri></maml:uri>
</maml:navigationLink>
<maml:navigationLink><maml:linkText>Export-PSCredentialtoJson</maml:linkText>
<maml:uri></maml:uri>
</maml:navigationLink>
</command:relatedLinks>
</command:command>
<command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp">
<command:details><command:name>Import-PSCredentialFromJson</command:name>
<command:verb>Import</command:verb>
<command:noun>PSCredentialFromJson</command:noun>
<maml:description><maml:para>Import a stored credential from a JSON file.
</maml:para>
</maml:description>
</command:details>
<maml:description><maml:para>This command will import a stored PSCredential object from a JSON file. It is assumed the JSON file was created with Export-PSCredentialtoJSON. This command will only work on the same computer where you exported the credential.
</maml:para>
</maml:description>
<command:syntax><command:syntaxItem><maml:name>Import-PSCredentialFromJson</maml:name>
<command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="0" aliases="none"><maml:name>Path</maml:name>
<maml:Description><maml:para>Enter the name of a json file
</maml:para>
</maml:Description>
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
<dev:type><maml:name>String</maml:name>
<maml:uri /></dev:type>
<dev:defaultValue>None</dev:defaultValue>
</command:parameter>
</command:syntaxItem>
</command:syntax>
<command:parameters><command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="0" aliases="none"><maml:name>Path</maml:name>
<maml:Description><maml:para>Enter the name of a json file
</maml:para>
</maml:Description>
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
<dev:type><maml:name>String</maml:name>
<maml:uri /></dev:type>
<dev:defaultValue>None</dev:defaultValue>
</command:parameter>
</command:parameters>
<command:inputTypes><command:inputType><dev:type><maml:name>System.String</maml:name>
</dev:type>
<maml:description><maml:para>
</maml:para>
</maml:description>
</command:inputType>
</command:inputTypes>
<command:returnValues><command:returnValue><dev:type><maml:name>PSCredential</maml:name>
</dev:type>
<maml:description><maml:para>
</maml:para>
</maml:description>
</command:returnValue>
</command:returnValues>
<maml:alertSet><maml:alert><maml:para>v1.0.0
</maml:para>
<maml:para>Learn more about PowerShell: http://jdhitsolutions.com/blog/essential-powershell-resources/
</maml:para>
</maml:alert>
</maml:alertSet>
<command:examples><command:example><maml:title>Example 1</maml:title>
<dev:code>PS C:\&gt; Import-PSCredentialFromJson -Path c:\scripts\admin.json
 
UserName Password
-------- --------
company\administrator System.Security.SecureString</dev:code>
<dev:remarks><maml:para>Import the credential from the JSON file. Normally you would save this to a variable so you could re-use it in your PowerShell session.
</maml:para>
</dev:remarks>
</command:example>
</command:examples>
<command:relatedLinks><maml:navigationLink><maml:linkText>Get-Credential</maml:linkText>
<maml:uri></maml:uri>
</maml:navigationLink>
<maml:navigationLink><maml:linkText>ConvertFrom-SecureString</maml:linkText>
<maml:uri></maml:uri>
</maml:navigationLink>
<maml:navigationLink><maml:linkText>Export-PSCredentialtoJson</maml:linkText>
<maml:uri></maml:uri>
</maml:navigationLink>
<maml:navigationLink><maml:linkText>Get-PSCredentialFromJson</maml:linkText>
<maml:uri></maml:uri>
</maml:navigationLink>
</command:relatedLinks>
</command:command>
</helpItems>