|
1 |
| -# {{ NAME }} |
| 1 | +# PSCredential |
2 | 2 |
|
3 |
| -{{ DESCRIPTION }} |
| 3 | +`PSCredential` is a PowerShell module that provides functions for managing credentials. |
| 4 | +It allows users to create, save, and restore `PSCredential` objects from disk. |
4 | 5 |
|
5 | 6 | ## Prerequisites
|
6 | 7 |
|
7 |
| -This uses the following external resources: |
8 |
| -- The [PSModule framework](https://github.com/PSModule) for building, testing and publishing the module. |
| 8 | +This module requires: |
| 9 | + |
| 10 | +- The [PSModule framework](https://github.com/PSModule) for building, testing, and publishing the module. |
9 | 11 |
|
10 | 12 | ## Installation
|
11 | 13 |
|
12 | 14 | To install the module from the PowerShell Gallery, you can use the following command:
|
13 | 15 |
|
14 | 16 | ```powershell
|
15 |
| -Install-PSResource -Name {{ NAME }} |
16 |
| -Import-Module -Name {{ NAME }} |
| 17 | +Install-PSResource -Name PSCredential |
| 18 | +Import-Module -Name PSCredential |
17 | 19 | ```
|
18 | 20 |
|
19 | 21 | ## Usage
|
20 | 22 |
|
21 |
| -Here is a list of example that are typical use cases for the module. |
| 23 | +Here are some typical use cases for the module. |
| 24 | + |
| 25 | +### Example 1: Creating a new `PSCredential` object |
| 26 | + |
| 27 | +This function generates a `PSCredential` object using user input. |
| 28 | + |
| 29 | +```powershell |
| 30 | +New-PSCredential |
| 31 | +``` |
22 | 32 |
|
23 |
| -### Example 1: Greet an entity |
| 33 | +This prompts the user for a username and password and returns a `PSCredential` object. |
24 | 34 |
|
25 |
| -Provide examples for typical commands that a user would like to do with the module. |
| 35 | +Alternatively, you can specify the credentials explicitly: |
26 | 36 |
|
27 | 37 | ```powershell
|
28 |
| -Greet-Entity -Name 'World' |
29 |
| -Hello, World! |
| 38 | +New-PSCredential -Username 'admin' -Password (ConvertTo-SecureString 'P@ssw0rd!' -AsPlainText -Force) |
30 | 39 | ```
|
31 | 40 |
|
32 |
| -### Example 2 |
| 41 | +### Example 2: Saving a `PSCredential` object to a file |
33 | 42 |
|
34 |
| -Provide examples for typical commands that a user would like to do with the module. |
| 43 | +You can save a credential to a file using `Save-PSCredential`: |
35 | 44 |
|
36 | 45 | ```powershell
|
37 |
| -Import-Module -Name PSModuleTemplate |
| 46 | +$credential = Get-Credential |
| 47 | +Save-PSCredential -Credential $credential -Path 'C:\secure\credential.cred' |
| 48 | +``` |
| 49 | + |
| 50 | +This saves the credential to `C:\secure\credential.cred`. |
| 51 | + |
| 52 | +### Example 3: Restoring a `PSCredential` object from a file |
| 53 | + |
| 54 | +To restore a credential object from a previously saved file: |
| 55 | + |
| 56 | +```powershell |
| 57 | +Restore-PSCredential -Path 'C:\secure\credential.cred' |
| 58 | +``` |
| 59 | + |
| 60 | +Alternatively, you can use pipeline input: |
| 61 | + |
| 62 | +```powershell |
| 63 | +'C:\secure\credential.cred' | Restore-PSCredential |
38 | 64 | ```
|
39 | 65 |
|
40 | 66 | ### Find more examples
|
41 | 67 |
|
42 | 68 | To find more examples of how to use the module, please refer to the [examples](examples) folder.
|
43 | 69 |
|
44 |
| -Alternatively, you can use the Get-Command -Module 'This module' to find more commands that are available in the module. |
45 |
| -To find examples of each of the commands you can use Get-Help -Examples 'CommandName'. |
| 70 | +Alternatively, you can use the following commands: |
| 71 | + |
| 72 | +- Find available commands in the module: |
| 73 | + |
| 74 | + ```powershell |
| 75 | + Get-Command -Module PSCredential |
| 76 | + ``` |
| 77 | + |
| 78 | +- Get examples for a specific command: |
| 79 | + |
| 80 | + ```powershell |
| 81 | + Get-Help -Examples New-PSCredential |
| 82 | + ``` |
46 | 83 |
|
47 | 84 | ## Documentation
|
48 | 85 |
|
49 |
| -Link to further documentation if available, or describe where in the repository users can find more detailed documentation about |
50 |
| -the module's functions and features. |
| 86 | +For further documentation, please refer to: |
| 87 | + |
| 88 | +- [PSCredential](https://psmodule.io/PSCredential/) |
51 | 89 |
|
52 | 90 | ## Contributing
|
53 | 91 |
|
54 |
| -Coder or not, you can contribute to the project! We welcome all contributions. |
| 92 | +Whether you're a coder or not, you can contribute to this project! |
55 | 93 |
|
56 | 94 | ### For Users
|
57 | 95 |
|
58 |
| -If you don't code, you still sit on valuable information that can make this project even better. If you experience that the |
59 |
| -product does unexpected things, throw errors or is missing functionality, you can help by submitting bugs and feature requests. |
60 |
| -Please see the issues tab on this project and submit a new issue that matches your needs. |
| 96 | +If you experience unexpected behavior, errors, or missing functionality, you can help by submitting bug reports and feature requests. |
| 97 | +Please visit the [issues tab](https://github.com/PSModule/PSCredential/issues) and submit a new issue. |
61 | 98 |
|
62 | 99 | ### For Developers
|
63 | 100 |
|
64 |
| -If you do code, we'd love to have your contributions. Please read the [Contribution guidelines](CONTRIBUTING.md) for more information. |
65 |
| -You can either help by picking up an existing issue or submit a new one if you have an idea for a new feature or improvement. |
| 101 | +If you are a developer, we welcome your contributions! |
| 102 | +Please read the [Contribution Guidelines](CONTRIBUTING.md) for more information. |
| 103 | +You can either help by picking up an existing issue or submit a new one if you have an idea for a feature or improvement. |
66 | 104 |
|
67 |
| -## Acknowledgements |
| 105 | +## Disclaimer |
68 | 106 |
|
69 |
| -Here is a list of people and projects that helped this project in some way. |
| 107 | +The Export-Clixml cmdlet is used to save credentials to disk, is not secure on Linux and macOS, and should be used with caution. |
| 108 | +For more information read the [Export-Clixml](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/export-clixml?view=powershell-7.5#example-4-exporting-a-credential-object-on-linux-or-macos) documentation. |
0 commit comments