I am trying to set the permissions of a file that I have moved to a new directory on the remote server. I am connected to the server via sFTP and the script is being run through PowerShell.
Any help would be great!.
Use this code to set remote file permissions via SFTP from PowerShell:
$sftp = New-Object Rebex.Net.Sftp
$attributes = New-Object Rebex.Net.SftpAttributes
$attributes.Permissions = [Rebex.Net.SftpPermissions] "OwnerWrite, OwnerRead"
Learn to use Rebex SFTP and other components from PowerShell.
Thanks Tomas that worked! BTW you are also right that you have to list out each of the permissions.
please check the forum question about setting remote file properties via SFTP.
Welcome to Q&A forum for C# and VB.NET developers working with following .NET components:
If you need immediate assistance, please contact us directly.