I have an array of users. But when I try to access the array in a function it isn't complete.
$script:users = @()
Function check-user{
foreach($user in $users){
write-host $user
}
}
foreach($img in $newImages){
$users += $username
}
If I check $users it has 2 objects. But when I debug the code and check the function it can only see 1 of those two objects. How do I amend this so PowerShell can see both objects?
$newImagesand$usernamecome from?$newImages, you want 10 copies of$usernamein$users? It's a bit unclear what is supposed to happen here. Please also review this help center article about how to put together simplified examples