Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

How to set the result on MSOLUser from Get-AdGroup

$
0
0

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


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>