Answer the question
In order to leave comments, you need to log in
How to write a profile availability check for multiple AD users?
Wrote a small check for the existence of a profile on the server. But it only works for one account. The truth is written clumsily, but still.
$ListProfileForRemove = (Get-ADUser –Identity i.zhukov | foreach { $_.SamAccountName}).ToString()
foreach ($ListUsersForRemove in $ListProfileForRemove)
{
$testPathGrapes = Test-Path "\\grapes\c$\Users\$ListProfileForRemove"
If ($testPathGrapes -eq $True) {
Write-Host "На сервере GRAPES доступны файлы профиля"
}
Else {
Write-Host "На сервера GRAPES файлы профиля не доступны"
}
}
Answer the question
In order to leave comments, you need to log in
By what criteria should these "few" be formed? Random?
In fact, the list is formed in these commands Get-ADUser –Identity i.zhukov
instead of them, for example, Get-AdUser -Filter 'name -Like "Test *"
will select all users starting with Test
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question