try{# Open the WinSCP.Session object using the WinSCP.SessionOptions object.$session.Open($SessionOption)

# Set the default -WinSCPSession Parameter Value for other cmdlets.(Get-Command-ModuleWinSCP-ParameterNameWinSCPSession).ForEach({$Global:PSDefaultParameterValues.Remove("$($_.Name):WinSCPSession")$Global:PSDefaultParameterValues.Add("$($_.Name):WinSCPSession",$session)})

# Append the host name to the WinSCP.Session object.Add-Member-InputObject$session-NotePropertyName"HostName"-NotePropertyValue$SessionOption.HostName