# Simple problem with import-csv

**URL:** <https://forums.powershell.org/t/simple-problem-with-import-csv/6896>\
**Category:** PowerShell Help\
**Created:** [July 28, 2016, 1:30pm UTC](https://forums.powershell.org/t/simple-problem-with-import-csv/6896 "2016-07-28T13:30:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![scott-windmiller](https://avatars.discourse-cdn.com/v4/letter/s/c4cdca/32.png) [@scott-windmiller](https://forums.powershell.org/u/scott-windmiller)\
**Post date:** [July 28, 2016, 1:30pm UTC](https://forums.powershell.org/t/simple-problem-with-import-csv/6896/1 "2016-07-28T13:30:09Z")

</div>

I have a simple CSV:

Name, Aashley, Adagdag,

I want to assign rights to a folder with that same name, which I have done in the past using this cmdlet, using:

$users5 = import-csv C:\Users\swindmiller\Desktop\Users5.csv ForEach ($Folder in $users5) { Add-NTFSAccess -path \\FileSERVER\Users\$Folder.Name -Account MYDOMAIN\$folder.Name -AccessRights FullControl

}

This is my error:

Add-NTFSAccess : Cannot bind parameter 'Account'. Cannot convert value "MYDOMAIN\@{Name=Aashley}.Name" to type "Security2.IdentityReference2". Error: "Some or all identity references could not be translated." At line:3 char:90 + ... fileSERVER\Users\$Folder.Name -Account MYDOMAIN\$folder.Name -Access ... + ~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (:) [Add-NTFSAccess], ParameterBindingException + FullyQualifiedErrorId : CannotConvertArgumentNoMessage,NTFSSecurity.AddAccess

I know the problem is in “@{Name=Aashley}.Name”, it’s not letting me reference just the name and I cannot for the life of me figure out why. Shouldn’t $Folder.Name just give me “Aashley”?

I KNOW this is going to be a stupid problem on my part so be easy 🙂

---

<div class="post-metadata">

**Author:** ![powershellish](https://avatars.discourse-cdn.com/v4/letter/p/b5ac83/32.png) [@powershellish](https://forums.powershell.org/u/powershellish)\
**Post date:** [July 28, 2016, 1:33pm UTC](https://forums.powershell.org/t/simple-problem-with-import-csv/6896/2 "2016-07-28T13:33:31Z")

</div>

```
Add-NTFSAccess -path "\\FileSERVER\Users\$($Folder.Name)" -Account "MYDOMAIN\$($folder.Name)" -AccessRights FullControl
```

Have to wrap the variable with a property in a subexpression $(). Otherwise it attempts to turn the variable into a string before it gets to the .name.

---

<div class="post-metadata">

**Author:** ![scott-windmiller](https://avatars.discourse-cdn.com/v4/letter/s/c4cdca/32.png) [@scott-windmiller](https://forums.powershell.org/u/scott-windmiller)\
**Post date:** [July 28, 2016, 1:55pm UTC](https://forums.powershell.org/t/simple-problem-with-import-csv/6896/3 "2016-07-28T13:55:21Z")

</div>

Thanks! I knew it was something simple but something I would need to know for the future…it worked perfectly.

Thanks for your fast help!

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:40pm UTC](https://forums.powershell.org/t/simple-problem-with-import-csv/6896/4 "2024-05-16T20:40:56Z")

</div>

Closed on May 16, 2024, 8:40pm UTC


