The first cell in the column containing the computer names must use the value “Name”.
$ListOfComputers = Import-csv –Path <INSERT PATH TO .CSV FILE>
foreach ($item in $ListOfComputers)
{
$ItemDetails = Get-ADComputer -identity $item.Name -properties * -ErrorAction SilentlyContinue -WarningAction SilentlyContinue
if ($ItemDetails -eq $NULL)
{
Write-Host "$item does not exist in AD" -ForegroundColor Yellow
$ItemDetails = $NULL
}
else
{
$ItemDetails.DistinguishedName
$GroupToAddTo = get-adgroup -Identity "<INSERT GROUP NAME>"
Add-ADGroupMember -Identity $GroupToAddTo -Member $ItemDetails.DistinguishedName
}
}
Thanks. After browse many web sites, your solution was the only that worked for me.
ReplyDeleteAlexis
MMORPG OYUNLAR
ReplyDeleteinstagram takipçi satın al
tiktok jeton hilesi
tiktok jeton hilesi
antalya saç ekimi
instagram takipçi satın al
ınstagram takipci satın al
metin2 pvp serverlar
Instagram takipci
YENİ PERDE MODELLERİ
ReplyDeletesms onay
Mobil odeme bozdurma
nft nasıl alınır
ankara evden eve nakliyat
trafik sigortası
DEDEKTÖR
web site kurma
Ask Kitaplari
Good content. You write beautiful things.
ReplyDeletevbet
taksi
mrbahis
vbet
sportsbet
hacklink
mrbahis
sportsbet
hacklink
sex videos
ReplyDelete4AX73
iznik
ReplyDeletekadıköy
kağıthane
kapadokya
karşıyaka
UKO3EG
hakkari
ReplyDeleteüsküdar
şırnak
başakşehir
kartal
WUE1
https://saglamproxy.com
ReplyDeletemetin2 proxy
proxy satın al
knight online proxy
mobil proxy satın al
DCCM0