Hi,
how to loop out the selected input value and able to loop out the rest of the property from imported csv file?
For example, I want to look properties from just based on the sAMAccountName.
This is my scripting:
$userInfo = Import-CSV D:\info.CSV
$name = @()
$sAMAccountName = @()
ForEach-Object {
$sAMAccountName = $userInfo.sAMAccountName
$name = $userInfo.properties
}
$inputName = Read-Host -Prompt "Input sAMAccountName"
if ($sAMAccountName -contains $inputName)
{
Write-Host "Users Exists"
$Where = [array]::IndexOf($sAMAccountName, $inputName)
Write-Host "property Name: " $Name[$Where]
}
else
{
write-host 'error: ' $Error
}
This is what I get: