Skip to content

Instantly share code, notes, and snippets.

View rchaganti's full-sized avatar
Slow to respond.

Ravikanth C rchaganti

Slow to respond.
View GitHub Profile
@rchaganti
rchaganti / armvisualize
Last active July 10, 2020 23:47
BlogSnippets
{{<armvisualize href="link-to-json-file">}}
{{<armvisualize "link-to-json-file">}}
@rchaganti
rchaganti / certPolicy.ps1
Created April 14, 2020 12:04
Cert Policy
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;
}
}
@rchaganti
rchaganti / clusterValidationReport.ps1
Created January 30, 2020 13:15
Parses the XML validation report from Test-Cluster into a PowerShell Object
[CmdletBinding()]
param
(
[Parameter(Mandatory = $true)]
[String]
$ValidationXmlPath
)
$xml = [xml](Get-Content -Path $ValidationXmlPath)
$channels = $xml.Report.Channel.Channel
function Get-HttpQueryString
{
[CmdletBinding()]
param
(
[Parameter(Mandatory = $true)]
[String]
$Uri,
[Parameter(Mandatory = $true)]
if (-not (Get-Module -ListAvailable -Name ImportExcel -ErrorAction SilentlyContinue))
{
Install-Module -Name ImportExcel -Force
}
$speakersJson = 'https://raw.githubusercontent.com/psconfeu/2019/master/data/speakers.json'
$sessionsJson = 'https://raw.githubusercontent.com/psconfeu/2019/master/sessions.json'
$speakers = ConvertFrom-Json (Invoke-WebRequest -UseBasicParsing -Uri $speakersJson).content
$sessions = ConvertFrom-Json (Invoke-WebRequest -UseBasicParsing -Uri $sessionsJson).content
#Show the HTML preview
$view = New-VSCodeHtmlContentView -Title "TestHTML" -ShowInColumn One
Set-VSCodeHtmlContentView -View $view -Content "<h1>Test Output</h1>"
Write-VSCodeHtmlContentView $view -Content "Hello, World!<br />"
@rchaganti
rchaganti / startupConfig.ps1
Created February 27, 2018 15:15
startupConfig.ps1
Configuration GCEDemo
{
Import-DscResource -ModuleName PSDesiredStateConfiguration -ModuleVersion 1.1
Node 'localhost'
{
WindowsFeature WebServer
{
Name = 'Web-Server'
Ensure = 'Present'
@rchaganti
rchaganti / firewallconfig.ps1
Created February 26, 2018 23:46
firewallconfig.ps1
Function Write-SerialPort ([string] $message) {
$port = new-Object System.IO.Ports.SerialPort COM1,9600,None,8,one
$port.open()
$port.WriteLine($message)
$port.Close()
}
Write-SerialPort ("Testing GCE Startup Script")
Set-NetFirewallRule -Name WINRM-HTTP-In-TCP-PUBLIC -RemoteAddress Any
Start-UdDashboard -Content {
New-UdDashboard -Title "Performance Dashboard" -Color '#FF050F7F' -Content {
New-UdRow {
New-UdColumn -Size 6 -Content {
New-UdRow {
New-UdColumn -Size 12 -Content {
New-UdTable -Title "Server Information" -Headers @(" ", " ") -Endpoint {
@{
'Computer Name' = 'NODE01'
'Operating System' = (Get-CimInstance -ComputerName NODE01 -ClassName Win32_OperatingSystem).Caption
function Get-ConfigurationDataAsObject
{
[CmdletBinding()]
Param (
[Parameter(Mandatory)]
[Microsoft.PowerShell.DesiredStateConfiguration.ArgumentToConfigurationDataTransformation()]
[hashtable] $ConfigurationData
)
return $ConfigurationData
}