Wednesday, August 28, 2019
Tuesday, August 13, 2019
One of my recent activity was to automate sending email to some Manager’s to provide their approval for their reportees to extend their employment contract for next one year. This can be done using SharePoint workflow, but the challenge is we are not privileged to use the SharePoint Designer.
So, we decided to use the PowerShell script to trigger an email using client context. Then we created required list columns and employee information’s and I created three calculated columns along with that,
- · First is for to get the number of days between last renewal date with today’s date (Today () – last renewal column)
- · Second is for to round the number to nearest digit (= Round (Calucaltedcolumn1,0))
- · Final calculated column is to indicate which items are crossed 365 days and it will set a Flag as Remind as a column value (=IF (second calculated column =< 365),” Remind”, “No”)).
But we were not realized that calculated column will be populate the value when the list items gets modified, since we are using Today() in formula. We can edit the list item using PowerShell but we required Modified date for some reason to track the approval process.
To overcome that, I used below snippet code to update calculated column without editing any items, what it will do it will just update the mentioned column and the it will populate the value.
Add-Type -Path "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"
$clientContext = New-Object Microsoft.SharePoint.Client.ClientContext "Site URL"
$listname ="List Name"
$field = $List.Fields
$ColumnField = $field | select -ExpandProperty InternalName
$Columnvalue = @("Column1","Column2","Column3")
Foreach($ColumnName in $Columnvalue)
#Get the List column
$ListColumn = $field.GetByInternalNameOrTitle($ColumnName)
Write-host "List Column Updated Successfully!"
Write-host "List Column not found!"
Thursday, August 1, 2019
Hi Readers, In this article we are going to learn how to create Virtual machine using Azure portal and Powershell console, as a first step we need to create resource group. so lets see what is resource group first.
Resource group is a primary layer of your azure environment, where you can provision, managing assets like VM, Virtual network, storage, etc. a resource group can be used to scope access control of administrative actions and every resource should have a resource group.
Create Resource group using azure portal
Step 1: Login https://portal.azure.com
Step 2: select resource group from your left navigation
Step 3: Click Add button and select your subscription and provide resource group name and select region
Step 4: click next to tags, it’s just an optional. You can provide value or ignore it
Step 5: finally click create from bottom and it will take few moments to create resource group at back-end
Create resource group using PowerShell
Before that we need to install azure PowerShell modules in your local machine, to install module run the following command in PowerShell
Once the module gets installed successfully, then connect to your azure tenant using below command
After connected to your tenant, run below command to create resource group
New- -Name "" -Location 'Central India'
Create Virtual machine using Azure Portal
Step 1: click virtual machine from left navigation
Step 2: click add and provide VM name, Image and specification on next screen
Step 3: Provide Administrator name and password and enable inbound port for 80) and RDP(3389) and click next from bottom
Step 4: you can select OS Disk type. You have option called Standard HDD, Standard SSD and Premium SSD. I am selecting premium SSD for better performance and click next
Step 5: For every resource azure will automatically create network IP and subnet by own, in this article I am going with default network IP and subnet
Step 6: you can skip Management, advance and tags. That’s not mandatory for all type of VM’s and click create once you reviewed all information.
Create using PowerShell
In powershell we can use more parameters to create virtual machine but in this article i used some basic parameters to create virtual machine like name, image, location and resource group name.
New- - "" -Location '