Powershell Groups from SP

Brass Contributor

Import-Module Microsoft.Online.Sharepoint.PowerShell -DisableNameChecking
$AdminURL = ""
$AdminName = ""

$SecurePassword = ConvertTo-SecureString $AdminPassword -AsPlainText -Force
$Credentials = New-Object System.Management.Automation.PSCredential -argumentlist $AdminUserName, $SecurePassword

Connect-SPOService -url $AdminURL -credential $Credentials

$SiteGroups = Get-SPOSiteGroup -Site $SiteURL -Group "tt1site Visitors"

Connect-AzureAD –Credential $Credentials

foreach($Group in $SiteGroups)
$C = Get-SPOSiteGroup -Site $SiteURL -Group $Group.Title | Select-Object -ExpandProperty Users
Get-AzureADGroupMember "$C"
#Get-AzureADGroupMember -ObjectId $Group.User


Hi , i'm having problem. I want to get every group from SP Group Visitors. Then i want get this id to azure and get every user frm this group. Whenever i run this script all id's are in string and I don't know how to separate them.

Best Regards 


0 Replies