I need to get the status on O365 for users which are members of a group:
This is is startup script.
$address =@()
foreach ($user in (Get-ADGroupMember -Identity "TESTGRoup" -Recursive)) {
try {
$address = Get-ADUser $user -Properties userprincipalname | Select -Expand userprincipalname
$_ | Set-MsolUser -UserPrincipalName $address -Blockcredential $true
}catch{
Write-Output "$LogDate $error[0] $($id)" | Out-File C:\temp\testLog.log -append
}
}I can get the result fine fror $address but when passing to "set-Msoluser" I get errors or blanks. Basically I don't know how to pipe the results from Get-User into another get-set command.
Thanks, M
Maelito