Created
February 25, 2011 03:24
-
-
Save pcting/843327 to your computer and use it in GitHub Desktop.
set-admin-password.ps1, Powershell script to reset the admin password for Eucalyptus instances
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param( | |
[int] $len = 6, | |
[string] $chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_" | |
) | |
$bytes = new-object "System.Byte[]" $len | |
$rnd = new-object System.Security.Cryptography.RNGCryptoServiceProvider | |
$rnd.GetBytes($bytes) | |
$result = "" | |
for( $i=0; $i -lt $len; $i++ ) | |
{ | |
$result += $chars[ $bytes[$i] % $chars.Length ] | |
} | |
Write-Host "Administrator password reset to $result" | |
net user administrator $result | |
$port= new-Object System.IO.Ports.SerialPort COM1 | |
$port.open() | |
$port.write("** Access Credentials **`n`nUsername: administrator`nPassword: $result`n") | |
$port.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment