Topic "using .ini vs SessionOptions Powershell"

Author Message
giermo
[View user's profile]

Joined: 2014-04-02
Posts: 9
Hello
I have a bunch of scripts getting and putting files to a ftp and sftp server using the sessionOptions.XXX commands in a powershell script.

I would like to use the .ini file instead, so that login credentials are better protected, versus being plain text in all the scripts. (can i have seperate ini files per ftp server?)

So far i got this:
$session = New-Object WinSCP.Session
($session).IniFilePath
I am new to PS, and see there is a get and set option for the IniFilePath Property

I have been however unable to implement this. (i used the gui to creat a .ini file to persuse as well)

I am stuck on how to implement this correctly.

Any syntax aid would be great.

Thanks
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25015
Location: Prague, Czechia
Using an INI file is not protecting your passwords. It's just obfuscating them.
See https://winscp.net/eng/docs/security_credentials#storing_password

You can implement your own obfuscation and read just credentials from some configuration file of your own, instead of using whole WinSCP INI file (It may cause you lot of troubles). Even better you can protect your configuration file with Windows file-level encryption and make it accessible with restricted account only (you can do the same with INI file obviously, or even easier, do it with your present scripts).

Anyway, to answer your question. I actually do not know what you are asking for. The Session.IniFilePath is a string property. Just set it with path to the INI file you have created with GUI.
giermo
[View user's profile]

Joined: 2014-04-02
Posts: 9
Okay thanks. Yeah, my plan was to now just create my own text file and parse it to get the credentials i need, .ini was too much of a complication lol

Thanks for the quick response. :)
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25015
Location: Prague, Czechia
I wrote an article on the topic:
https://winscp.net/eng/docs/guide_protecting_credentials_for_automation
giermo
[View user's profile]

Joined: 2014-04-02
Posts: 9
thanks
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License