'Adding list of users to list of computers. -logonworkstations to , i need a script for list of users,computeras in csv and each user to map with comp
I have a list of users and computers in csv
csv format
User computer
xyx comp1
zzz comp2
axsc comp3
$ADusername = Import-Csv -Path "C:\Users\xyx\Desktop\user.csv"
>> $complist = Import-Csv -Path "C:\Users\xyz\Desktop\computer.csv" | ForEach-Object {$_.NetBIOSName}
>> $comparray = $complist -join ","
>> Set-ADUser -id $_.UserList -LogonWorkstations $comparray
Set-ADUser : Cannot validate argument on parameter 'Identity'. The argument is null. Provide a valid value for the argument, and then try running the command again.
At line:4 char:16
+ Set-ADUser -id $_.UserList -LogonWorkstations $comparray
+ ~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Set-ADUser], ParameterBindingValidationException
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
