Alternatively, you can use `
[ SessionOptions.ParseUrl ](/eng/docs/library_sessionoptions_parseurl) `
method.

There is no direct mapping for opening stored site using ` site ` parameter,
because .NET assembly [ does not share configuration
](/eng/docs/library_from_script#default_config) with graphical/scripting mode.
You need to configure all your site settings directly in your code (using ` [
SessionOptions ](/eng/docs/library_sessionoptions) ` class).

Switches mapping:

Switch  |  Mapping   
---|---  
` -privatekey ` |  When the value is an SSH private key path, set ` [ SessionOptions.SshPrivateKeyPath ](/eng/docs/library_sessionoptions#sshprivatekeypath) ` .   
When the value is a hex dump of SSH private key file contents, store the
contents (not the hex dump) to ` [ SessionOptions.SshPrivateKey
](/eng/docs/library_sessionoptions#sshprivatekey) ` .  
` -hostkey ` |  Set ` [ SessionOptions.SshHostKeyFingerprint ](/eng/docs/library_sessionoptions#sshhostkeyfingerprint) ` .   
For special values ` * ` and ` acceptnew ` , set [ `
SessionOptions.SshHostKeyPolicy `
](/eng/docs/library_sessionoptions#sshhostkeypolicy) to `
SshHostKeyPolicy.GiveUpSecurityAndAcceptAny ` or ` SshHostKeyPolicy.AcceptNew
` , respectively.  
` -clientcert ` |  Set ` [ SessionOptions.TlsClientCertificatePath ](/eng/docs/library_sessionoptions#tlsclientcertificatepath) ` .   
` -certificate ` |  Set ` [ SessionOptions.TlsHostCertificateFingerprint ](/eng/docs/library_sessionoptions#tlshostcertificatefingerprint) ` .   
` -passphrase ` |  Set ` [ SessionOptions.PrivateKeyPassphrase ](/eng/docs/library_sessionoptions#privatekeypassphrase) ` .   
` -passive ` |  Set ` [ SessionOptions.FtpMode ](/eng/docs/library_sessionoptions#ftpmode) ` to ` FtpMode.Passive ` for ` on ` or ` FtpMode.Active ` for ` off ` .   
[ Enumeration syntax ](/eng/docs/library_powershell#enums) in PowerShell is
like ` [WinSCP.FtpMode]::Passive ` .  
` -implicit ` |  Set ` [ SessionOptions.FtpSecure ](/eng/docs/library_sessionoptions#ftpsecure) ` to ` FtpSecure.Implicit ` ( ` [WinSCP.FtpSecure]::Implicit ` in PowerShell).   
` -explicit ` |  Set ` [ SessionOptions.FtpSecure ](/eng/docs/library_sessionoptions#ftpsecure) ` to ` FtpSecure.Explicit ` ( ` [WinSCP.FtpSecure]::Explicit ` ).   
` -timeout ` |  Set ` [ SessionOptions.Timeout ](/eng/docs/library_sessionoptions#timeout) ` .   
` -username ` |  Set ` [ SessionOptions.UserName ](/eng/docs/library_sessionoptions#username) ` .   
` -password ` |  Set ` [ SessionOptions.Password ](/eng/docs/library_sessionoptions#password) ` .   
` -passwordsfromfiles ` |  Read the file in your code and assign a respective property.   
PowerShell example: ` $sessionOptions.Password  =  (Get-Content  $path)[0]  `  
` -rawsettings ` |  Call ` [ SessionOptions.AddRawSettings ](/eng/docs/library_sessionoptions_addrawsettings) ` for every key/value pair in switch parameters.   
` -filezilla ` |  Convert the full equivalent syntax suggested, when the ` open ` command is executed.   
  
_Advertisement_

For example, following script snippet:

    
    
    [open](https://winscp.net/eng/docs/scriptcommand_open) sftp://martin:mypassword@example.com/ -hostkey="ssh-rsa 2048 xxxxxxxxxxx..."

maps to following [ PowerShell ](/eng/docs/library_powershell) code:

    
    
    $sessionOptions = New-Object WinSCP.[SessionOptions](https://winscp.net/eng/docs/library_sessionoptions) -Property @{
        # sftp://
        Protocol = [WinSCP.Protocol]::Sftp
        HostName = "example.com"
        UserName = "martin"
        Password = "mypassword"
        # -hostkey
        SshHostKeyFingerprint = "ssh-rsa 2048 xxxxxxxxxxx..."
    }
     
    $session = New-Object WinSCP.[Session](https://winscp.net/eng/docs/library_session)
    # Connect
    $session.Open($sessionOptions)

  1. With UTF-8 encoding use of BOM is optional. With UTF-16 the BOM is mandatory. Only the first line of the file is considered. Use of more lines is reserved for the future.  Back 
  2. WinSCP loo