Set-User
SharePoint Online: Configures properties on an existing user
#Requires -Version 5.1
#Requires -Modules Microsoft.Online.SharePoint.PowerShell
[CmdletBinding()]
Param(
[Parameter(Mandatory = $true)]
[string]$LoginName,
[Parameter(Mandatory = $true)]
[string]$Site,
[bool]$IsSiteCollectionAdmin
)
Process {
try {
$cmdArgs = @{ ErrorAction = 'Stop'; LoginName = $LoginName; Site = $Site }
if ($PSBoundParameters.ContainsKey('IsSiteCollectionAdmin')) { $cmdArgs.Add('IsSiteCollectionAdmin', $IsSiteCollectionAdmin) }
$result = Set-SPOUser @cmdArgs | Select-Object *
if ($null -ne $result) { foreach ($item in $result) { $item | Add-Member -NotePropertyName Timestamp -NotePropertyValue (Get-Date -Format "yyyy-MM-dd HH:mm:ss") -PassThru -Force } }
}
catch { throw }
}User login name
Full URL of the site collection
Set whether the user is a site collection administrator