We are excited to announce that the IIS.NET Forums are moving to the new Microsoft Q&A experience. Learn more >

FTP - Get-WebConfiguration to retrieve details of usersRSS

1 reply

Last post Feb 15, 2021 02:35 AM by Jalpa Panchal

  • FTP - Get-WebConfiguration to retrieve details of users

    Feb 14, 2021 12:25 AM|pelagos|LINK

    Hi ther

    I am using this command to set the users access on an FTP site

    Add-WebConfiguration "/system.ftpServer/security/authorization" -value @{accessType="Allow";roles="";permissions="Read,Write";users="*"} -PSPath IIS:\ -location $SiteName

    I want to be able to use Get-WebConfiguration to be able to retrieve what user/users have access and use an If /Else block to be able to add the users if they don't already exist. I cant seem to come up with the correct syntax to make this work??

    I can use this and it will get the users and their permissions:

    Get-WebConfiguration "/system.ftpserver/security/authorization" -Location $SiteName  | Foreach{$_.GetCollection() | Foreach {$_.Attributes | Format-Table name, value} }

    How do I format this to be able to get the actual users in an If /Else statement?

    Basically - If user already has access move on Else "Add-WebConfiguration....."



  • Re: FTP - Get-WebConfiguration to retrieve details of users

    Feb 15, 2021 02:35 AM|Jalpa Panchal|LINK


    You could try to store the value of the user and permissions in variable and in if condition you can check that values.

    you could refer to below post for reference:


    .NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.