Skip to main content

Posts

Showing posts with the label PowerShell

Identity client runtime library (IDCRL) did not get a response from the login server.

Recently I was doing some testing with a background PowerShell and encountered a weird error. “Identity client runtime library (IDCRL) did not get a response from the login server”. The error that you might encounter while working with PowerShell. This error is very misleading when it comes to identifying what could go wrong. After doing quite a good amount of research below are the probable causes for the error. Invalid Credentials MFA (Multi-Factor Authentication) Manage security defaults. Solutions Invalid Credentials Check if your credentials are wrong. Especially if you are using variables. MFA (Multi-Factor Authentication) Check if MFA is enabled on the account which you are using. These only affect you badly if you are developing PowerShell for a background Job. Go to Microsoft 365 admin center Users -> Active users -> Select the user -> Manage multifactor authentication -> Select the user -> Disable multi-factor authentication. M

SharePoint Site Script & Site Design

  H ope you are doing fine and safe in this pandemic situation. I recently came up with an opportunity to work with SharePoint Site Designs. SharePoint Site templates are now replaced with Site designs in Modern Sites.   SharePoint allows us to create JSON schema to apply our custom options that we want to add. Below are the things we can apply using site script. Create a new SharePoint list Define a new site column Define a new content type Add a navigation link Remove a navigation link Apply a theme Set branding properties Set a site logo Join a hub site Install an add-in or solution Register an extension Activate a Feature Trigger a flow Configure regional settings Add users (principals) to SharePoint Groups Manage guest access Let us assume we have a JSON schema created. I am taking below sample from MS documentation for reference.   We will now be adding above JSON schema to SharePoint as Site Script. Below is the command we execute. $site_script = ‘{   "$schema"

SPFx File Upload using Pnp

Today I came across a requirement to upload file to SharePoint Document library. This task was to be done using SPFx. Pnp helped me with this. Here is the code i used. Below is the code for uploading file and meta data. private   UploadFile ():  void  {          let   input  = < HTMLInputElement >  document . getElementById ( "fileUpload" );          let   files  =  input . files ;          for  ( let   index  =  0 ;  index  <  files . length ;  index ++) {              const   file  =  files [ index ];              if  ( file . size <=  10485760 )    {      //upload small file in document library           pnp . sp . web . getFolderByServerRelativeUrl ( "/sites/Dummy/ProcessDocuments/" ). files . add ( file . name ,  file ,  true ). then ( f =>  {                   f . file . getItem (). then ( item   =>  {                      item . update ({ ProcessInformationIDId:   itemID }). then ( f   =>  {            

Enable Folder Creation option in all SharePoint Online Sites using PowerShell

Below is the Powershell script to Enable Folder creation option on Document Library. [System.Reflection.Assembly]::LoadFile("C:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll")| Out-Null [System.Reflection.Assembly]::LoadFile("C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll")| Out-Null function Get-SPOAllWeb {    param (    [Parameter(Mandatory=$true,Position=1)] [string]$Username, [Parameter(Mandatory=$true,Position=2)] $AdminPassword,         [Parameter(Mandatory=$true,Position=3)] [string]$Url )   $ctx=New-Object Microsoft.SharePoint.Client.ClientContext($Url)   $ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Username, $AdminPassword)   $ctx.Load($ctx.Web.Webs)   $ctx.Load($ctx.Web)    $lists = $ctx.web.Lists    $list = $lists.GetByTitle("Underwriting")  

Get list of External users from all Site Collections in Office365

Below is the powershell script to iterate through all Site Collections and get list if External users per site collection. $Sites = Get-SPOSite | select * foreach($Site in $Sites)         {                    Write-Host "Getting External Users from " $Site.Url            Get-SPOUser -Site $Site.Url |  Where-Object { $_.LoginName -like "*EXT*"} |ft -AutoSize                    }