....
$password = ConvertTo-SecureString $pwd -asplaintext -force
$creds = New-Object -typename System.Management.Automation.PSCredential -argumentlist $usr, $password
if (!$swis) {
Write-Output "connecting to Orion...."
$swis = Connect-Swis –Credential $creds –Hostname $hostname
}
...