Skip to content

Instantly share code, notes, and snippets.

View ChendrayanV's full-sized avatar
🏠
Working from home

ChenV ChendrayanV

🏠
Working from home
View GitHub Profile
@ChendrayanV
ChendrayanV / SharePointDocumentLibraryInventory.ps1
Created November 16, 2023 12:58
SharePoint Document Library Inventory
param (
$SiteUrl,
$DocumentLibraryName,
$BatchSize = 500
)
Import-Module ""
Import-Module ""
@ChendrayanV
ChendrayanV / script.ps1
Last active November 10, 2023 11:11
A PowerShell Script to retrieve SCALAR properties value of the GitLab projects using GraphQL
param (
$Organization,
$PrivateToken,
$ProjectFullPath
)
$query = @{
query = '{
@ChendrayanV
ChendrayanV / ResizeVM.ps1
Created December 21, 2021 02:08
Resize Azure VM - REST API
$Body = [pscustomobject]@{
properties = [pscustomobject]@{
hardwareProfile = [pscustomobject]@{
vmSize = 'Standard_D2s_v3'
}
}
} | ConvertTo-Json -Compress
$SubcriptionId = ''
$ResourceGroup = ''
$VMName = ''
@ChendrayanV
ChendrayanV / app.ps1
Created November 19, 2021 13:28
Pode - Web Server
Start-PodeServer {
Add-PodeEndpoint -Address * -Port 3000 -Protocol Http
Set-PodeViewEngine -Type PSHTML -Extension PS1 -ScriptBlock {
param($path, $data)
return (. $path $data)
}
Add-PodeRoute -Method Get -Path '/' -ScriptBlock {
Write-PodeViewResponse -Path 'index.ps1'
}
Add-PodeRoute -Method Post -Path '/cost-estimation' -ScriptBlock {
@ChendrayanV
ChendrayanV / VM-PowerState-ARG.PS1
Created February 7, 2021 08:59
Azure Virtual Machines Power State (Resource Graph Query)
$Query = "Resources
| where type =~ 'microsoft.compute/virtualMachines'
| project id, VMName = tostring(name), Location = tostring(location),
ResourceGroup = tostring(resourceGroup),
SubscriptionId = tostring(subscriptionId),
OSType = tostring(properties.storageProfile.osDisk.osType),
PowerState = iff(
tostring(
split(
properties.extended.instanceView.powerState.code, '/'
@ChendrayanV
ChendrayanV / function.json
Created October 5, 2019 05:49
Trigger HTML Email using Azure Functions (PSHTML - PowerShell)
/*Every 45 Minutes*/
{
"bindings": [
{
"name": "Timer",
"type": "timerTrigger",
"direction": "in",
"schedule": "0 */45 * * * *"
}
]
@ChendrayanV
ChendrayanV / home.ps1
Created January 7, 2019 08:19
PSHTML | MetroUI | PowerShell | Polaris
# Import-Module .\assemblies\PSHTML\PSHTML.psd1
html -Content {
head -Content {
Title -Content "iCMS | Home"
Link -href "./../assets/css/metro.min.css" -rel "stylesheet"
Link -href "./../assets/css/metro-colors.min.css" -rel "stylesheet"
Link -href "./../assets/css/metro-rtl.min.css" -rel "stylesheet"
Link -href "./../assets/css/metro-icons.min.css" -rel "stylesheet"
script -src "./../assets/js/jquery-3.3.1.min.js"
script -src "./../assets/js/metro.min.js"
@ChendrayanV
ChendrayanV / server.ps1
Created November 17, 2018 03:12
Simple Login Page Demo Using PSHTML and Polaris (PowerShell Modules)
Import-Module Polaris -Verbose
Import-Module PSHTML -Verbose
Add-Type -AssemblyName System.Web
New-PolarisGetRoute -Path "/Login" -Scriptblock {
$HTML = html {
head {
Title "Login Page"
}
@ChendrayanV
ChendrayanV / Date.ps1
Created September 28, 2018 08:46
Get-Date
Get-Date | ConvertTo-Json -Compress
@ChendrayanV
ChendrayanV / Index.pug
Created August 17, 2018 09:18
PUG Wizard Demo
<!DOCTYPE html>
html(lang="en")
head
meta(charset="UTF-8")
meta(name="viewport", content="width=device-width, initial-scale=1.0")
meta(http-equiv="X-UA-Compatible", content="ie=edge")
title Wizard
style
include ./style/style.css
link(rel="stylesheet", href="https://fonts.googleapis.com/css?family=Raleway")