Monday, April 29, 2019

SharePoint : Create a button or link in a list that can Check Workflow Status or Start an MS Flow

1. Create link on List to check Workflow Status (OnPrem SP2010/2013 & SPO ModernUI)

Example of link column on list to view Workflow Status: View Example of link to Workflow Status:

SPO Modern UI:

SharePoint Column Formatting ModernUI : column formatting to customize SharePoint

0. Get GUID of list :

e.g: 8B418B49-95E8-4851-9CBB-F04542182AB5

1. Add Column,

e.g: See Here

2. Set Column Customization: e.g:

SPO: COLUMN Customizations Cool!

{

"$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",

"elmType": "a",

"txtContent": "@currentField",

"attributes": {

"target": "_blank",

"href": "='[YourSite]/_layouts/15/Workflow.aspx?List={8B418B49-95E8-4851-9CBB-F04542182AB5}&ID=' + [$ID]"

}

}

3. View List

OnPrem

0. Get GUID of list :

e.g: 8B418B49-95E8-4851-9CBB-F04542182AB5

1. Calculated Column:

e.g: See here

2. Apply Formula:

="https://smhi365.sharepoint.com/sites/MigrationTest/_layouts/15/Workflow.aspx?List={8B418B49-95E8-4851-9CBB-F04542182AB5}&ID="&ID

2. Create a buttin to start an MS Flow:

Example showing button and link:

More Details Here:

https://wonderlaura.com/2018/07/18/button-in-sharepoint-list-to-trigger-microsoft-flow/

Thursday, April 25, 2019

Check .Net Framework Version on any Windows Machine

  1. Open the command prompt (i.e Windows + R → type "cmd").
  2. Type the following command, all on one line: This will list all the .NET versions.

reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP"

Results: http://prntscr.com/ngyyuz


  1. To get the latest .NET 4 version; Type following cmd, on a single line:

reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\full" /v version

results: http://prntscr.com/ngyyxn

Tuesday, April 16, 2019

Powershell + Windows Service : Disable and Stop a Service if it is Enabled and Running.

1. Create Script

2. Create bat file to call Script

3.Schedule Windows task to invoke bat file every (n) minutes

Name: AutoStopStartService.ps1

In my case I am stopping Windows Update, since Win10 likes to restart/re-enable Windows Update it seems every day atleast, even if the Admin disables it!

1. Script: see here

param (

[string]$service = $(throw "-service is required.")

)

write-output 'AutoStopStartService()-> START, svc is $service'

# get service

$ServiceName = $service

$arrService = Get-Service -Name $ServiceName

# get start mode

write-output $arrService.Status

$stu = Get-WmiObject -Class Win32_Service -Property StartMode -Filter "Name='$service'" | Select StartMode;

# if not Disabled, Disable it

if ($stu -NotMatch 'Disabled')

{

write-output 'AutoStopStartService()-> DISABLE it!'

Start-Sleep -seconds 10

set-service $ServiceName -startuptype disabled

}

# if Running, Stop it

if ($arrService.Status -ne 'Running')

{

write-output 'AutoStopStartService()-> Service already stopped!'

}

else

{

write-output 'AutoStopStartService()-> STOP IT!'

Stop-Service $ServiceName

Start-Sleep -seconds 10

$arrService.Refresh()

Write-Host 'Service NEW STATUS-> ' $arrService.Status

}

# done

write-output 'AutoStopStartService()-> DONE'

Exit


2. Create bat file to call Script

powershell .\AutoStopStartService.ps1 -service wuauserv -WindowStyle Hidden

3.Windows Task: Schedule to invoke bat file every (n) minutes

See here