locked
Problem with script RRS feed

  • Question

  • Import-Csv C:\csv\proxy.csv | Foreach {
        Get-ADUser $_.Name | Set-ADUser -Add @{proxyAddresses = ($_.proxy)}
    }
    Can you help me? Script turn me back error...
    Thursday, January 11, 2018 10:32 AM

All replies

  • Hi,

    Could you please let us know how the proxy.csv looks like? And the exact error message would be helpful as well.

    Thursday, January 11, 2018 11:04 AM
  • Of course!

    CSV:

    Name, proxy

    user1, user12@test.com

    Error:

    Cannot validate argument on parametr 'Identity'. The argument is null or an element collection contains a null value.

    At line:2 char:16

    Thursday, January 11, 2018 11:11 AM
  • There seems to be an issue with $_.Name part. It looks like if it is empty.

    What happens, if you just execute this part?

    Import-Csv C:\csv\proxy.csv

    Thursday, January 11, 2018 11:14 AM
  • He's show me many weird signs . Maybe problem is in file? I save this csv in excel
    Thursday, January 11, 2018 11:20 AM
  • Open the .csv file in editor to see what's really in it.

    • Proposed as answer by TobyU Thursday, January 11, 2018 12:28 PM
    Thursday, January 11, 2018 11:23 AM
  • Yes, problem was in file. Thanks!
    Thursday, January 11, 2018 11:36 AM
  • Perfect, thanks for your feedback.
    Thursday, January 11, 2018 12:28 PM