public/Generate-Passwords.ps1

# Password Generator

function Generate-Passwords {

    [CmdletBinding()]
    param (
        [Parameter()]
        [int]
        $PasswordQty
    )
    
    $PasswordFile = "$env:USERPROFILE\Passwords.txt"
    Write-Host "Password text file is here $PasswordFile" -ForegroundColor Green

    if (test-path $PasswordFile) {
        Remove-Item $PasswordFile
        }

    $counter = 0

    1..$PasswordQty | ForEach-Object {

        $counter++
        Write-Progress -Activity 'Generating Passwords' -CurrentOperation "Password $_" -PercentComplete (($counter / $PasswordQty) * 100)
        Invoke-WebRequest http://www.dinopass.com/password/simple | Select-Object Content -ExpandProperty Content

        } | Out-File $PasswordFile -Append

}