How to Add Logon Workstation through Csv file in Active Directory PowerShell Command.
Csv file
format
Bulk Workstations
Add through CSV file
# Add LogonWorkstation through Csv File
Import-Module ActiveDirectory
$machineList = Import-Csv -Path "C:\PClist.csv"
| ForEach-Object
{$_.NetBIOSName}
$UserProperties = Get-ADUser -Identity pri9 -Properties LogonWorkstations
$comparry = ($UserProperties).LogonWorkstations
foreach($machine
in $machineList)
{
$comparry
+= ","
+$machine
}
Set-ADUser -Identity
Pri9 -LogonWorkstations
$comparry
# For Checking
Get-ADUser pri9
-Properties LogonWorkstations
This script run add new one only or incremental
ReplyDeleteboth
ReplyDelete