Dec 27 2021 10:55 PM - edited Dec 29 2021 12:32 AM
PowerShell rookie need help!
Want to figure out about #Q1 #Q2 #Q3
Appreciate!
try{
Connect-MicrosoftTeams
Connect-SPOService
$url = "http://abc.sharepoint.com/sites/"
$owner = "Terry"
$displayName = "TerryTeam"
$group = New-Team -DisplayName $displayName -Description $description -Visibility Private -Owner $owner
Add-TeamUser -GroupId $group.GroupId -User $user
Add-TeamUser -GroupId $group.GroupId -User $user -Role $owner
$siteUrl = $url + $group.MailNickName
Set-SPOSite -Identity $siteUrl -Sharingcapability ExistingExternalUserSharingOnly
Set-SPOSite -Identity $siteUrl -StorageQuota 10240
# ---------------Get result---------------
$teamName = Get-Team -GroupId $group.GroupId | Select-Object DisplayName # 1
# or
$teamName = Get-Team -GroupId $group.GroupId # 2
$teamName.DisplayName
# expect = TerryTeam
# result = wondering this code can really work or not.
# Q1 = Want to know 1 or 2 which can really work? Or both can't?
$teamOwner = Get-TeamUser -GroupId $group.GroupId -Role Owner
# expect = Terry
# result = Microsoft.Teams.PowerShell.TeamsCmdlets.GetTeamUserResponse
# Q2 = I think the code is no porblem, but keep error like this.
$storageResult = Get-SPOSite -Identity $siteUrl | Select StorageQuota
# expect = 10240
# result = @{StorageQuota=10240}
# Q3 = Did I missed some solution?
}
catch{
}
finally{
}
Dec 28 2021 02:30 AM
What is it you are trying to achieve? Create a script to report on a Team and underlying quota of the SharePoint Site?
A good article for getting the SharePoint Site Quota is here:
Think $Site.StorageQuota and $Site.StorageUsageCurrent is what you are looking for Q3.
Also notice at the top, should $url = https:// not http://
Let's see if we can get Q3 right then move onto the other 2 :D
Hope that helps
Best, Chris
Dec 29 2021 01:11 AM