Forum Post: RE: Get NTFS permissions in a ListBox.

hi aleksandar, my looking is also the same, but i need to provide permission for folder from the list of users from the list box here is my code $listBox1 = New-Object System.Windows.Forms.ListBox $listBox1.FormattingEnabled = $True $System_Drawing_Size = New-Object System.Drawing.Size $System_Drawing_Size.Width = 340 $System_Drawing_Size.Height = 170 $listBox1.Size = $System_Drawing_Size $listBox1.DataBindings.DefaultDataSourceUpdateMode = 0 $listBox1.Name = „Permission listBox1” $listbox1.Location = New-Object System.Drawing.Point(228,370) $listBox1.TabIndex = 3 $form.Controls.Add($listBox1) $textBox = New-Object System.Windows.Forms.TextBox $textBox.Location = New-Object System.Drawing.Point(10,80) $textBox.Size = New-Object System.Drawing.Size(215,30) $form.Controls.Add($textBox) $Nametext = $textBox.Text $AddButton = New-Object System.Windows.Forms.Button $AddButton.Location = New-Object System.Drawing.Point(25,130) $AddButton.Size = New-Object System.Drawing.Size(75,23) $AddButton.Text = „Add” #$AddButton.DialogResult = [System.Windows.Forms.DialogResult]::OK $form.AcceptButton = $AddButton $form.Controls.Add($AddButton) $AddButton.add_Click($handler_AddButton_Click) $Nametext = $textBox.Text $handler_AddButton_Click= { $Nametext = $textBox.Text if($AddButton.Add_Click) { $listBox1.Items.Add($Nametext)} } $form.Add_Shown({$textBox.Select()}) $result = $form.ShowDialog() #$username = $listBox1.Items #write-host $username $readper = „READ” $folderpath = „c:temp” $outFileName = „shan1234″ net share ” $outFileName=$folderpath” /grant:”foreach ($item in $listBox1.Items)$items,$readper” /unlimited /cache:none $permissies = Get-ACL $folderpath | select -expand access | select -expand identityreference | select -expand value foreach ($permissie in $permissies) { $listBox1.Items.Add($permissie)

GD Star Rating
loading...