Skip to content

Commit af30cea

Browse files
committedFeb 11, 2014
Added PowerShell local admin password function
1 parent 48075ca commit af30cea

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed
 

‎uniquepass.ps1

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
function Hash($textToHash)
2+
<#
3+
.SYNOPSIS
4+
PowerShell function to generate/retrieve unique local administrator passwords.
5+
.DESCRIPTION
6+
Takes an MD5 hash of a (optional) unique string, a hardcoded string, and the hostname in which
7+
the function is run on.
8+
.NOTES
9+
Author : jakx_
10+
.EXAMPLE
11+
hash testing
12+
#>
13+
{
14+
$hostname = hostname
15+
16+
$s = "foobar"
17+
18+
$new = "$hostname" + "$s" + "$texttoHash"
19+
20+
$hashme = new-object System.Security.Cryptography.MD5CryptoServiceProvider
21+
22+
$tohash = [System.Text.Encoding]::UTF8.GetBytes($new)
23+
24+
$ByteArray = $hashme.ComputeHash($tohash)
25+
26+
foreach($byte in $ByteArray)
27+
28+
{
29+
30+
$pass += $byte.ToString()
31+
32+
}
33+
34+
return $pass;
35+
36+
}

0 commit comments

Comments
 (0)
Please sign in to comment.