Posts

How to execute parallel/ Threaded jobs in PowerShell

Image
  Many times we need to work in parallel when executing the Powershell commands. Today in this post I will tell how we can execute the commands in parallel.  In my case, I have used these parallel jobs for the migration of SharePoint On-Prem to SharePoint Online using Sharegate, executing multiple instances and then monitoring those instances to initiate as soon as any of the instances is finished executing. Step 1: Installing the Module To leverage the benefit of the parallel jobs, we need to install the Module so to install the module, execute the following command Install-Module   - Name  " ThreadJob "   - Scope AllUsers Once the module is installed, then you are ready to go. Step 2: Execute Parallel Jobs Now you can start parallel jobs in the background. Here is the sample for executing the parallel jobs $Job  =   Start-ThreadJob   - FilePath  " .\PowershellScript.ps1 "   - ArgumentL...

How to stop computer from sleeping

Image
  This is a very generic post, but I felt though this is small thing but can be of good use. So, many times we do run the PowerShell scripts or some processing on our local computer and it is blocked due to the system entering into sleep mode. Due to which the process gets stopped. There are third-party apps for this but do not rely on installing many 3rd party apps to my system. So I found the script which does the job for me. I know what's written in the script so I am confident while running this script. Here is the script, Clear-Host $myshell  =   New-Object   - com  " Wscript.Shell " while  ( $true ) {      Write-Host  ([ char ] 9829 )  - ForegroundColor Red  - NoNewline     $myshell.sendkeys( " . " )      Start-Sleep   - Seconds  300 } Hope this will help you as well, do comment and share if you like it. Happy Coding..!! Sumit Kanchan

Alternative to Discussion list in SharePoint Online

Image
  In SharePoint Online one of the most missed features from the legacy system is the ability to create discussion forums. Since we do not have the OOB functionality, but we still can achieve it using the OOB features. In this post, I will show you how you can create the discussion forums using OOB features and with a more attractive UI.  Let's start and set up the discussion Forum. STEP 1: Create necessary columns in Site Pages Library To Achieve the functionality, I have made use of the "Site Pages" Library as it gives you the OOB ability to comment and like on the page. In order to make it fully usable, we will create a column  PageType: This will tell us whether the page created is a discussion or the page Values: Page, Discussion STEP 2: Create Custom View Create a View (in my case I have created the view by the name Discussion), ...

Play Big with large lists and document libraries

Image
  What if the SharePoint list or library grew too big? This is a very common question when you are designing the SharePoint solution. So in this article, I will try to explain how you can do that. Impact of unhandled Large List So, the problem first, What is the impact if it grew too large..?? Will we lose data ... ?? NO Will, the data be deleted... ?? NO Is data not safe.. ?? NO What is the Threshold limit? So what is the impact of a large list?? yes, Threshold is the cause The impact is that you will get the threshold error if your view contains records greater than 5000. When any list or library view returns records of more than 5000 it displays the threshold error. This is the hard-line limit a view can show up the number of records. So, there are multiple ways you can handle this error Solution 1: Switch to Modern View, as the latest the best and will be continuously improved. For modern Microsoft is continuously evolving and more enhancement will be there in the future. Solut...

Retrieve SharePoint List Item Versions in SharePoint Online using PnP

Image
  In many cases, we need to identify the versions of the SharePoint List Item. So here is the way to get all the versions of the item using PnP. function   Get-ItemVersion  {      param  ($spURL, $spListTitle)           $checked  =  ([ char ] 8730 )           Write-Host   " Creating connection to the SharePoint Online..... "   - ForegroundColor Yellow  - NoNewline     $spConnection  =   Connect-PnPOnline   - Url $spURL  - UseWebLogin  - ReturnConnection  - ErrorAction Stop      Write-Host  $checked  - ForegroundColor Green       Write-Host   " Reading list items from ' $listTitle '..... "   - ForegroundColor Yellow  - NoNewline    ...

Function for Digital Unit Conversion in Power BI (KB, MB, GB...)

Image
  While displaying reports it is very common to convert the units. So today I will be displaying the function that can be used in order to convert the Units Space  = VAR  total  =     SUM ( Table1[ Used   Space ] )  +   0 RETURN      IF  (         total  <   1024 ,         FORMAT ( total,  " #0.0# B "  ),          IF  (             total  <  POWER (  2 ,  20  ),             FORMAT ( total  /  POWER (  2 ,  10  ),  " #0.0# KB "  ),              IF  (   ...

Retrieve Secret from Key-Vault using PowerShell in Azure Runbook

Image
  Today I will showcase to you how to retrieve the Secret from the Key-Vault using PowerShell in Azure Runbook. This is one of the most common scenarios whenever you are writing the script and need credentials for authentication.  Step 1: Check if the following Modules are available in the Azure Runbook AZ.KeyVault AZ.Accounts To check to Navigate to your Automation account, then in the left navigation click on Modules and search for the modules Step 2: If the modules mentioned in Step 1 are not found, then navigate to the " Modules gallery ", search for the modules, and then install. Once installed, re-check for the installed modules as mentioned in step 1.  Step 3: Copy the below script and paste it into your runbook      try  {         $connectionName  =   " AzureRunAsConnection "          # Get the connection "AzureRunAsConnection...