Posted On March 31, 2019

PowerShell RandomPassword Function

kimconnect 0 comments
blog.KimConnect.com >> Codes , Windows >> PowerShell RandomPassword Function
function randomPassword{

   # return a reasonably randomized password that starts with "KimConnect:" plus 25 characters with some complexities

   $append="KimConnect:";

    $script:salt = ([char[]]([char]33..[char]95) + ([char[]]([char]97..[char]126)) + 0..8 | sort {Get-Random})[0..24] -join '';

    return "$append$salt";

    }

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

Basic JavaScript: Manipulate Arrays With push()

// Setupvar myArray = [["John", 23], ["cat", 2]];// Add a dog... ezmyArray.push(["dog",3]);

PowerShell: Find Process IDs of a Locked File and Kill It

There's a newer iteration of this function here. $targetFile='C:\Users\kimconnect\Desktop\testfile.csv' function killPidLockedFile($filename){ if (!(Get-Command handle.exe -ErrorAction…

PowerShell: Get Try Catch Exception Type of a Function

# This function will return the exception type so that it could be specified on…