|
KiTTY : ForumLast modification : - |
|
|
|---|---|---|
| Welcome / Recent changes / News / Forum / Download / Contacts | Edit | |
Bulk Password changes
Stevo - Fri 10/11/2017 17:51:37 CET +0100
Guys
Has anyone solved the problem where you use the same username/password combos on multiple hosts, and are faced with updating loads of sessions each time you change your password ? I knocked up a bulk password powershell script, where a session called (username) holds the current password for user username and copies the current registry value for Password for that session to all sessions that use the same username. Unfortunately it doesn't actualy work, down I suspect to the stored password being encrypted under a key based on the session name plus other odds n sods. Anyone worked around this problem ? Cyd - Fri 10/11/2017 18:37:11 CET +0100
There is encrypted password generator: http://www.9bis.net/kitty/?file=genpass.exe
You can use it in a .BAT file to generate a .REG file that will modify the registry. Stevo - Sat 11/11/2017 18:12:06 CET +0100
I can call that from my script !! it's kludgy, but why break the habit of a lifetime :D :D
Many many thanks Cyd!! Stevo - Wed 29/11/2017 20:09:55 CET +0100
This is Bulk-Change-Kitty-passwords.ps1, a powershell script that uses genpass.exe to update all your sessions that use a particular user to a given password. It also supports folders so you can keep particular sessions that use the same username with different passwords in different folders, allowing them to be updated separately.
Bulk-Change-Kitty-passwords.ps1 =============================== param([string]$User, [string]$Password, [string]$Folder = "Default") $scriptPathArray = ($MyInvocation.MyCommand).Definition.Split("") $scriptName = $scriptPathArray[$scriptPathArray.Length - 1] if ($psboundparameters.count -eq 0) { Write-Host "Usage Bulk-Change-Kitty-passwords.ps1:" Write-Host " -User " Write-Host " Changes all passwords for user " Write-Host " -Password " Write-Host " password to be used" Write-Host " -Folder " Write-Host " Only change passwords for user in Folder , defaults to `"Default`"" Write-Host "e.g." Write-Host "Bulk-Change-Kitty.ps1 root abc123" Write-Host " sets all instances of root's password in the Default folder to abc123." exit } elseif ($User.length -eq 0) { Write-Host "User is mandatory" exit } elseif ($Password.length -eq 0) { Write-Host "Password is mandatory" exit } $ChangedPasswordCount = 0 $ChangedPasswordTimes = "times." $GenpassCmd = "C:\Program Files (x86)\Utils\genpass.exe" $RegKey = (Get-ChildItem 'HKCU:\Softwarebis.com\KiTTY\Sessions')
ForEach ($Item in $Items) { $CurrentUser = $Item.UserName $CurrentHostName = $Item.HostName $CurrentTermType = $Item.TerminalType $CurrentFolder = $Item.Folder # Only process if correct user and in correct folder If (($CurrentUser -eq $User) -and ($CurrentFolder -eq $Folder)) { $TempPassword = & $GenpassCmd $Password $CurrentHostName $CurrentTermType Set-ItemProperty -Path $Item.PSPath -Name Password -value $TempPassword $ChangedPasswordCount++ } }
{$ChangedPasswordTimes = $ChangedPasswordTimes.Remove(4,1)} Write-Host "Changed password for username $User in folder $Folder $ChangedPasswordCount $ChangedPasswordTimes" Answer |
||
|
Wiki utilisant PumaWiki 1.0, merci aux membres de la PuTTY Team 2026/06/10 06:04 -- en -- 216.73.216.200 -- |
||