Skip to content

Commit

Permalink
Create password.md
Browse files Browse the repository at this point in the history
  • Loading branch information
suchsoak authored Jan 7, 2024
1 parent 2d04647 commit 7684d98
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions Doc/password.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

```sh
_ __ _
| '_ \ __ _ ___ ___ _ __ __ ___ _ _ __| |
| .__// _` |(_-/(_-/ \ V V // _ \| '_|/ _` |
|_| \__/_|/__//__/ \_/\_/ \___/|_| \__/_|
Github:github.com/suchsoak
BY: suchsok
```

The script starts by displaying the value of the variable $pass using the Write-Host command. This is likely to provide some context or instruction to the user.

The script then prompts the user to enter a password using the Read-Host command. The entered password is stored in the variable `$password`.

Next, the script prompts the user to enter a file path using the Read-Host command. The entered file path is stored in the variable $way.

The script then uses the `ConvertTo-SecureString` command to convert the password into a secure string. The -String parameter specifies the password to be converted, and the -AsPlainText parameter indicates that the password is provided as plain text. The resulting secure string is stored in the variable $secureString.

The script uses the `ConvertFrom-SecureString` command to convert the secure string into an encrypted standard string. This encrypted string is then written to a file specified by the $way variable using the Set-Content command.

The script checks if the $secureString variable has a value. If it does, it displays the message `"Password saved!"` using the Write-Host command. This indicates that the password was successfully saved to the file.

If the $secureString variable does not have a value, the script displays the message `"Had a Problem, verify the path!!"` using the Write-Host command. This suggests that there was an issue with the file path provided by the user.

The script includes a catch block, which is used to handle any errors that may occur during the execution of the previous commands. If an error occurs, the script displays the message "There was an error with the previous command. Please try again." using the Write-Host command.

In summary, this script allows the user to enter a password and a file path, and then securely saves the password to the specified file.

|scrip| link |
|-----|------|
|password.ps1| https://github.com/suchsoak/Powershell_script/tree/main/powershell

0 comments on commit 7684d98

Please sign in to comment.