Get-SPOWeb.ps1

##############################
#.SYNOPSIS
#Initializes a specific web object.
#
#.DESCRIPTION
#Initializes a specific web object.
#
#.PARAMETER Context
#The context of the web object to be initialized.
#
#.PARAMETER Web
#The web object to be initialized.
#
#.EXAMPLE
#Get-SPOWeb -Context $Context
#
#Get-SPOWeb -web $context.web.webs[5]
#
#.NOTES
#No Notes
##############################
Function Get-SPOWeb{
    [CmdletBinding(DefaultParameterSetName="Context")]
    Param(
        [Parameter(ParameterSetName="Context",Mandatory=$true,ValueFromPipeline)]
        [Microsoft.SharePoint.Client.ClientRuntimeContext[]]
        $Context = $Global:SPOCSOMContext,

        [Parameter(ParameterSetName="web",Mandatory=$True,ValueFromPipeline)]
        [Microsoft.SharePoint.Client.Web[]]
        $Web
    )

    Begin{

    }
    Process{

        #If web(s), initilized them.
        If($Web){
            [Microsoft.SharePoint.Client.Web[]]$result = @()
            Foreach($w in $Web){
                $result += Initialize-SPOCSOMCollections -CSOMCollection $w -ReturnObject
            }
        }

        #If context, initialize root web in context.
        else{    
            $result = Initialize-SPOCSOMCollections -CSOMCollection $Context.Web -ReturnObject
        }

        $result | Initialize-SPOCSOMObjectProperty -PropertyName "HasUniqueRoleAssignMents"
        #Return results.
        return ,$result
    }
    End{
    
    }
}