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 / RESTAPIAuth.ps1
Last active July 5, 2017 04:58
Visual Studio Team Services REST API - PAT Authentication using PowerShell
# Visual Studio Team Services REST API - PAT Authentication using PowerShell
$UserName = "chendrayan.venkatesan@contoso.com"
$PersonalAccessToken = "Access Token"
$Authentication = "{0}:{1}" -f ($UserName,$PersonalAccessToken)
$Authentication = [System.Text.Encoding]::ASCII.GetBytes($Authentication)
$Authentication = [System.Convert]::ToBase64String($Authentication)
@ChendrayanV
ChendrayanV / QueryHPSM9.py
Last active January 13, 2018 14:12
A sample code to query HPSM9 incident using python
from zeep import Client
from zeep.transports import Transport
from requests import Session
from requests.auth import HTTPBasicAuth
session = Session()
session.auth = HTTPBasicAuth('userName' , 'password')
wsdl = "http://hostname:xxxx/sc62server/PWS/IncidentManagement.wsdl"
client = Client(wsdl=wsdl,transport=Transport(session=session))
@ChendrayanV
ChendrayanV / TrustCertsPolicy.ps1
Created January 31, 2018 10:23
PS Certificate Policy
Clear-Host
add-type @"
using System.Net;
using System.Security.Cryptography.X509Certificates;
public class TrustAllCertsPolicy : ICertificatePolicy {
public bool CheckValidationResult(
ServicePoint srvPoint, X509Certificate certificate,
WebRequest request, int certificateProblem) {
return true;
}
@ChendrayanV
ChendrayanV / PSinNode.md
Last active February 5, 2018 14:42
Call PowerShell in Node JS

Print Dingbat in Node JS using PowerShell

var shell = require('node-powershell');
let ps = new shell(
    {
        executionPolicy : 'bypass',
        noProfile : true
    }
);
@ChendrayanV
ChendrayanV / Get-xTrueSightEventById.ps1
Last active March 6, 2018 11:05
Query TrueSight Events by ID (mc_ueid)
function Get-xEventById {
[CmdletBinding()]
param (
[Parameter(Mandatory)]
$Uri,
[Parameter(Mandatory, ValueFromPipeline, ValueFromPipelineByPropertyName)]
$Mcueid,
@ChendrayanV
ChendrayanV / GetSPOUserProfileInformation.ps1
Created May 8, 2018 10:31
Demo Web App to Build resume through SharePoint Online information | Node.js , PowerShell and CSOM
Import-Module .\assemblies\Microsoft.SharePoint.Client.dll
Import-Module .\assemblies\Microsoft.SharePoint.Client.UserProfiles.dll
$userName = "chendrayan@contoso.onmicrosoft.com"
$adminPassword = "MySuperPassword" | ConvertTo-SecureString -AsPlainText -Force
$spoCredential = [Microsoft.SharePoint.Client.SharePointOnlineCredentials]::new($userName, $adminPassword)
$spoClientContext = [Microsoft.SharePoint.Client.ClientContext]::new("https://chensoffice365-admin.sharepoint.com")
$spoClientContext.Credentials = $spoCredential
$spoUsers = $spoClientContext.Web.SiteUsers
$spoClientContext.Load($spoUsers)
@ChendrayanV
ChendrayanV / PSDemo.ps1
Created July 19, 2018 05:51
PSDemo - Scripted REST API
[pscustomobject]@{
FirstName = "Chendrayan"
LastName = "Venkatesan"
DisplayName = "Chendrayan Venkatesan"
}
@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")
@ChendrayanV
ChendrayanV / Date.ps1
Created September 28, 2018 08:46
Get-Date
Get-Date | ConvertTo-Json -Compress
@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"
}