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

Windows Server 2019 Remote Desktop Black Screen Problem

While there's no definite solution to this issue, here are some options to work around…

How To Add or Remove a Path in Windows Environmental Paths

There are 2 functions to Add and Remove, at your convenience: # addEnvironmentalPath.ps1 $pathToAdd='C:\Scripts' $pathToRemove='C:\Scripts'…

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…