Skip to content

Instantly share code, notes, and snippets.

@xoner
Created November 29, 2012 10:26
Show Gist options
  • Save xoner/4168058 to your computer and use it in GitHub Desktop.
Save xoner/4168058 to your computer and use it in GitHub Desktop.
Simple function to load putty inside Conemu hosted powershell given a hostname or a saved session name.
function pssh()
{
Param
(
[Parameter(Mandatory=$true)]
[String]
$destinationHost = $null
)
if($host -ne $null)
{
# Check if exists a saved session with the given destination,
# If it doesn't exists try a direct ssh connection to the destination
if(Test-Path "HKCU:\Software\SimonTatham\PuTTY\Sessions\$destinationHost")
{
iex "putty -new_console -load $destinationHost"
}
else
{
iex "putty -new_console -ssh $destinationHost"
}
}
else
{
Write-Host -Foregroud-Color red "A host name or saved session name must be provided"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment