Office 365: How to add several users to SPO Sites using Add-SPOUser!

This time I’m sharing a PowerShell script that will allow you to add several users to different SharePoint Online (SPO) sites using Add-SPOUser cmdlet. All the required information (SPO Site Url, SPO Site Group and User Login) is read from a CSV file with the following structure:

Add_Users_To_SPO_File_Format

And this is the full script (you can download from here: https://gallery.technet.microsoft.com/How-to-add-serveral-users-a7e19ead)

############################################################################################################################################
#Script that allows to add Users to a SPO Group
# Required Parameters:
#  -> $sUserName: User Name to connect to the SharePoint Admin Center.
#  -> $sMessage: Message to show in the user credentials prompt.
#  -> sInputFile: CSV File with the Site Collections information.
############################################################################################################################################

$host.Runspace.ThreadOptions = "ReuseThread"

#Definition of the function that allows to add a user to a Group in a SharePoint Online Site
function Add-SPOUsersToGroup
{
    param ($sSiteColUrl,$sGroup,$sUserToAdd)
    try
    {    
        Write-Host "----------------------------------------------------------------------------"  -foregroundcolor Green
        Write-Host "Adding $sUserToAdd as member of $Group in $sSiteColUrl" -Foregroundcolor Green
        Write-Host "----------------------------------------------------------------------------"  -foregroundcolor Green
        
        Add-SPOUser -Site $sSiteColUrl -LoginName $sUserToAdd -Group $sGroup 
                
        Write-Host "----------------------------------------------------------------------------"  -foregroundcolor Green
        Write-Host "User $sUserToAdd succesfully added to $sSiteColUrl !!!" -Foregroundcolor Green
        Write-Host "----------------------------------------------------------------------------"  -foregroundcolor Green
    }
    catch [System.Exception]
    {
        Write-Host -Foregroundcolor Red $_.Exception.ToString()   
    }    
}

#Function that allows to add users to SharePoint Groups in different Site Collections.
#The information about the Site Collection, SharePoint Group and User to be added is read from a CSV file
function Add-SPOUsersToGroupFromCSV
{
    param ($sInputFile)
    try
    {   
        # Reading the Users CSV file
        $bFileExists = (Test-Path $sInputFile -PathType Leaf) 
        if ($bFileExists) { 
            "Loading $sInputFile for processing..." 
            $tblUsers = Import-CSV $sInputFile            
        } else { 
            Write-Host "$sInputFile file not found. Stopping the import process!" -foregroundcolor Red
            exit 
        }

    
        # Adding Users To Groups
        foreach ($spoUser in $tblUsers) 
        { 
          
            #$spoUser.SPOSCollection + $spoUser.SPOGroup 
            Add-SPOUsersToGroup -sSiteColUrl $spoUser.SPOSCollection -sGroup $spoUser.SPOGroup -sUserToAdd $spoUser.SPOUserLogin
        } 
    }
    catch [System.Exception]
    {
        Write-Host -Foregroundcolor Red $_.Exception.ToString()   
    } 
}
 
$sUserName = "<O365AdminUser>@<O365Domain>.onmicrosoft.com"
#$sPassword = Read-Host -Prompt "Enter your password: " -AsSecureString  
$sPassword=ConvertTo-SecureString "<UserPassord>" -asplaintext -force
$sSPOAdminCenterUrl="https://<O365Domain>-admin.sharepoint.com/"
$msolcred = Get-Credential -UserName $sUserName -Message $sMessage
Connect-SPOService -Url $sSPOAdminCenterUrl -Credential $msolcred

$ScriptDir = Split-Path -parent $MyInvocation.MyCommand.Path
$sInputFile=$ScriptDir+ "\<File_Name>.csv"

Add-SPOUsersToGroupFromCSV -sInputFile $sInputFile
Anuncios

Office 365: Como añadir varios a usuarios a sitios de SPO mediante Add-SPOUser!

En esta ocasión os comparto un script PowerShell que os permitirá añadir varios usuarios a distintos sitios de SharePoint Online (SPO) mediante Add-SPOUser. La información de los usuarios y los sitios de SPO se lee desde un archivo CSV con el siguiente formato:

Add_Users_To_SPO_File_Format

Y el script en cuestión es el siguiente (Podéis descargarlo desde aquí: https://gallery.technet.microsoft.com/How-to-add-serveral-users-a7e19ead):

############################################################################################################################################
#Script that allows to add Users to a SPO Group
# Required Parameters:
#  -> $sUserName: User Name to connect to the SharePoint Admin Center.
#  -> $sMessage: Message to show in the user credentials prompt.
#  -> sInputFile: CSV File with the Site Collections information.
############################################################################################################################################

$host.Runspace.ThreadOptions = "ReuseThread"

#Definition of the function that allows to add a user to a Group in a SharePoint Online Site
function Add-SPOUsersToGroup
{
    param ($sSiteColUrl,$sGroup,$sUserToAdd)
    try
    {    
        Write-Host "----------------------------------------------------------------------------"  -foregroundcolor Green
        Write-Host "Adding $sUserToAdd as member of $Group in $sSiteColUrl" -Foregroundcolor Green
        Write-Host "----------------------------------------------------------------------------"  -foregroundcolor Green
        
        Add-SPOUser -Site $sSiteColUrl -LoginName $sUserToAdd -Group $sGroup 
                
        Write-Host "----------------------------------------------------------------------------"  -foregroundcolor Green
        Write-Host "User $sUserToAdd succesfully added to $sSiteColUrl !!!" -Foregroundcolor Green
        Write-Host "----------------------------------------------------------------------------"  -foregroundcolor Green
    }
    catch [System.Exception]
    {
        Write-Host -Foregroundcolor Red $_.Exception.ToString()   
    }    
}

#Function that allows to add users to SharePoint Groups in different Site Collections.
#The information about the Site Collection, SharePoint Group and User to be added is read from a CSV file
function Add-SPOUsersToGroupFromCSV
{
    param ($sInputFile)
    try
    {   
        # Reading the Users CSV file
        $bFileExists = (Test-Path $sInputFile -PathType Leaf) 
        if ($bFileExists) { 
            "Loading $sInputFile for processing..." 
            $tblUsers = Import-CSV $sInputFile            
        } else { 
            Write-Host "$sInputFile file not found. Stopping the import process!" -foregroundcolor Red
            exit 
        }

    
        # Adding Users To Groups
        foreach ($spoUser in $tblUsers) 
        { 
          
            #$spoUser.SPOSCollection + $spoUser.SPOGroup 
            Add-SPOUsersToGroup -sSiteColUrl $spoUser.SPOSCollection -sGroup $spoUser.SPOGroup -sUserToAdd $spoUser.SPOUserLogin
        } 
    }
    catch [System.Exception]
    {
        Write-Host -Foregroundcolor Red $_.Exception.ToString()   
    } 
}
 
$sUserName = "<O365AdminUser>@<O365Domain>.onmicrosoft.com"
#$sPassword = Read-Host -Prompt "Enter your password: " -AsSecureString  
$sPassword=ConvertTo-SecureString "<UserPassord>" -asplaintext -force
$sSPOAdminCenterUrl="https://<O365Domain>-admin.sharepoint.com/"
$msolcred = Get-Credential -UserName $sUserName -Message $sMessage
Connect-SPOService -Url $sSPOAdminCenterUrl -Credential $msolcred

$ScriptDir = Split-Path -parent $MyInvocation.MyCommand.Path
$sInputFile=$ScriptDir+ "\<File_Name>.csv"

Add-SPOUsersToGroupFromCSV -sInputFile $sInputFile

Office 365: How to get the list of First Release Users in PowerShell!

If you have configured selective First Release in your Office 365 tenant, you can easily get the list of First Release Users by means of the following PowerShell script:

https://gallery.technet.microsoft.com/How-to-get-First-Relase-db0ee3e0

############################################################################################################################################
# Script that allows to list of users to whom First Release has been configured in an Office 365 Tenant
# Required Parameters:
#  -> $sUserName: User Name to connect to Office 365.
#  -> $sMessage: Message to show in the user credentials prompt.
#  -> $sOutputFile: CSV File with the First Release Users exported.
############################################################################################################################################

$host.Runspace.ThreadOptions = "ReuseThread"

#Definition of the function that allows to export users configured in First Release
function Get-FirstReleaseUsers
{
    param ($sOutputFile)
    try
    {    
        Write-Host "----------------------------------------------------------------------------"  -Foregroundcolor Green
        Write-Host "Getting all First Relase Users in Office 365" -Foregroundcolor Green
        Write-Host "----------------------------------------------------------------------------"  -Foregroundcolor Green
        
        $FirsReleaseUsers= Get-MsolUser | Where-Object { $_.ReleaseTrack -like "StagedRolloutOne"}|select Displayname,UserPrincipalName        
        $FirsReleaseUsers
        $FirsReleaseUsers | Export-csv -Path $sOutputFile -NoTypeInformation

    }
    catch [System.Exception]
    {
        Write-Host -ForegroundColor Red $_.Exception.ToString()   
    }    
}

$sUserName = "<O365Admin>@<O465Domain>.onmicrosoft.com"
#$sPassword = Read-Host -Prompt "Enter your password: " -AsSecureString 
$sPassword=ConvertTo-SecureString "<User_Password>" -asplaintext -force
$msolcred = Get-Credential -UserName $sUserName -Message $sMessage
Connect-MsolService -Credential $msolcred

$ScriptDir = Split-Path -parent $MyInvocation.MyCommand.Path
$sOutputFile = $ScriptDir+ "\PS_FirstRelaseUsers.csv"

Get-FirstReleaseUsers -sOutputFile $sOutputFile

Referencia:

Office 365: Como obtener el listado de usuarios configurados en modo First Relase con PowerShell!

Si habéis configurado First Release en Office 365 para ciertos usuarios y queréis obtener el listado de usuarios por medio de PowerShell, lo podéis conseguir mediante el siguiente Script que podéis descargaros desde el siguiente enlace: https://gallery.technet.microsoft.com/How-to-get-First-Relase-db0ee3e0

############################################################################################################################################
# Script that allows to list of users to whom First Release has been configured in an Office 365 Tenant
# Required Parameters:
#  -> $sUserName: User Name to connect to Office 365.
#  -> $sMessage: Message to show in the user credentials prompt.
#  -> $sOutputFile: CSV File with the First Release Users exported.
############################################################################################################################################

$host.Runspace.ThreadOptions = "ReuseThread"

#Definition of the function that allows to export users configured in First Release
function Get-FirstReleaseUsers
{
    param ($sOutputFile)
    try
    {    
        Write-Host "----------------------------------------------------------------------------"  -Foregroundcolor Green
        Write-Host "Getting all First Relase Users in Office 365" -Foregroundcolor Green
        Write-Host "----------------------------------------------------------------------------"  -Foregroundcolor Green
        
        $FirsReleaseUsers= Get-MsolUser | Where-Object { $_.ReleaseTrack -like "StagedRolloutOne"}|select Displayname,UserPrincipalName        
        $FirsReleaseUsers
        $FirsReleaseUsers | Export-csv -Path $sOutputFile -NoTypeInformation

    }
    catch [System.Exception]
    {
        Write-Host -ForegroundColor Red $_.Exception.ToString()   
    }    
}

$sUserName = "<O365Admin>@<O465Domain>.onmicrosoft.com"
#$sPassword = Read-Host -Prompt "Enter your password: " -AsSecureString 
$sPassword=ConvertTo-SecureString "<User_Password>" -asplaintext -force
$msolcred = Get-Credential -UserName $sUserName -Message $sMessage
Connect-MsolService -Credential $msolcred

$ScriptDir = Split-Path -parent $MyInvocation.MyCommand.Path
$sOutputFile = $ScriptDir+ "\PS_FirstRelaseUsers.csv"

Get-FirstReleaseUsers -sOutputFile $sOutputFile

Referencia:

Office 365: FAQs about Flow y PowerApps (I)!

As customers and partners start using or considering to use Flow and PowerApps, more and more questions are arising about both services. Fortunately, Microsoft is making strong efforts to answer those questions and as a proof of that, you can check Chris McNulty FAQ in the Microsoft Tech Community:

https://techcommunity.microsoft.com/t5/SharePoint/GA-Microsoft-PowerApps-and-Flow/m-p/25921#M2185

Q. What does Microsoft’s commitment to PowerApps and Microsoft Flow mean for historic business solutions on SharePoint, like InfoPath?

A. As we announced at Ignite, PowerApps and Microsoft Flow are tools for business users to build business applications and automation in SharePoint today and tomorrow. They are the successors to InfoPath and SharePoint Designer for many common business scenarios, especially custom forms used on SharePoint lists.

Q. Will Microsoft still support InfoPath and SharePoint Designer?

A. As we announced earlier in 2016:

  • SharePoint Server 2016 will include an ongoing capability to host InfoPath Forms Services. InfoPath Forms Services on SharePoint 2016 will be supported for the duration of SharePoint 2016’s support lifecycle.
  • InfoPath Forms Services on Office 365 will continue to be supported.
  • InfoPath 2013 and SharePoint Designer 2013 will be the last versions of those products. SharePoint Designer is not being re-released with SharePoint Server 2016, although we will continue to support custom workflows built with SharePoint Designer and hosted on SharePoint Server 2016 and Office 365. Support for InfoPath 2013 and SharePoint Designer 2013 will match the support lifecycle for SharePoint Server 2016, running until 2026.

Q. What can customers expect to see inside SharePoint Online?

A. The release is principally a licensing event. If you have previously enabled preview features inside SharePoint Online, PowerApps and Microsoft Flow will continue to appear in the App Launcher and as elements of modern lists. If you had disabled access to preview features, users will see those integrations enabled in the next few weeks.

Q. How can Office 365 customers connect to custom data sources?

A. Every Office 365-licensed user of PowerApps and Microsoft Flow can create a custom API data connection, in addition to the intrinsic ability to connect to sources like SQL, Exchange, Yammer, Box and Twitter.

Q. How is user access managed/licensed?

A. Flow and PowerApps are managed separately. Here is documentation on how users are managed for Microsoft Flow. Here is documentation on how users are managed for Microsoft PowerApps. They are both quite similar in implementation, and provide options to help prevent existing users from joining an Office 365 tenant.

Office 365: FAQs sobre Flow y PowerApps (I)!

A medida que más clientes y partners de Microsoft se plantean el uso de PowerApps y Microsoft Flow, más y más cuestiones están surgiendo en torno a las capacidades de ambos servicios, planes de precios, etc. Afortunadamente Microsoft está haciendo muchos esfuerzos para resolver estas dudas y como prueba en este post os quiero compartir las FAQs que Chris McNulty ha compartido en la Microsoft Tech Community:

https://techcommunity.microsoft.com/t5/SharePoint/GA-Microsoft-PowerApps-and-Flow/m-p/25921#M2185

Q. What does Microsoft’s commitment to PowerApps and Microsoft Flow mean for historic business solutions on SharePoint, like InfoPath?

A. As we announced at Ignite, PowerApps and Microsoft Flow are tools for business users to build business applications and automation in SharePoint today and tomorrow. They are the successors to InfoPath and SharePoint Designer for many common business scenarios, especially custom forms used on SharePoint lists.

Q. Will Microsoft still support InfoPath and SharePoint Designer?

A. As we announced earlier in 2016:

  • SharePoint Server 2016 will include an ongoing capability to host InfoPath Forms Services. InfoPath Forms Services on SharePoint 2016 will be supported for the duration of SharePoint 2016’s support lifecycle.
  • InfoPath Forms Services on Office 365 will continue to be supported.
  • InfoPath 2013 and SharePoint Designer 2013 will be the last versions of those products. SharePoint Designer is not being re-released with SharePoint Server 2016, although we will continue to support custom workflows built with SharePoint Designer and hosted on SharePoint Server 2016 and Office 365. Support for InfoPath 2013 and SharePoint Designer 2013 will match the support lifecycle for SharePoint Server 2016, running until 2026.

Q. What can customers expect to see inside SharePoint Online?

A. The release is principally a licensing event. If you have previously enabled preview features inside SharePoint Online, PowerApps and Microsoft Flow will continue to appear in the App Launcher and as elements of modern lists. If you had disabled access to preview features, users will see those integrations enabled in the next few weeks.

Q. How can Office 365 customers connect to custom data sources?

A. Every Office 365-licensed user of PowerApps and Microsoft Flow can create a custom API data connection, in addition to the intrinsic ability to connect to sources like SQL, Exchange, Yammer, Box and Twitter.

Q. How is user access managed/licensed?

A. Flow and PowerApps are managed separately. Here is documentation on how users are managed for Microsoft Flow. Here is documentation on how users are managed for Microsoft PowerApps. They are both quite similar in implementation, and provide options to help prevent existing users from joining an Office 365 tenant.