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
Function Get-AvailableIPv4Address {
param (
[System.Collections.ArrayList] $IPRange
)
$MaxThreads = 30
$ScriptBlock = {
Param (
[String]$IPAddress
)
@rchaganti
rchaganti / 2_0-Storage_Account.json
Created November 10, 2015 15:26
ARM Template for deploying storage account
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"storageAccountName": {
"type": "string",
"defaultValue": "MyARMDemo",
"minLength": 3,
"maxLength": 24,
"metadata": {
@rchaganti
rchaganti / DSCResourcesISESnippets.ps1
Last active March 13, 2016 11:06
ISE Snippets for DSC Resources (PowerShell 4.0 and 5.0)
$GetTargetResource = @'
#TODO - Add the logic for Get-TagetResource
#TODO - Always return a hashtable from this function
#TODO - Remove $Ensure if it is not required
function Get-TargetResource
{
[OutputType([Hashtable])]
param (
[Parameter()]
[ValidateSet('Present','Absent')]
param (
[Parameter()]
[ValidateSet('VMM','OM','DPM','SCORH','SM','All')]
[String] $Component = 'All',
[Parameter()]
[String] $Destination = $env:TEMP
)
Begin {
function Get-ConfigurationDataAsObject
{
[CmdletBinding()]
Param (
[Parameter(Mandatory)]
[Microsoft.PowerShell.DesiredStateConfiguration.ArgumentToConfigurationDataTransformation()]
[hashtable] $ConfigurationData
)
return $ConfigurationData
}
@rchaganti
rchaganti / Get-PENetworkAdapter.ps1
Created November 24, 2014 12:05
Get-PENetworkAdapter
#Download the module from http://en.community.dell.com/techcenter/systems-management/w/wiki/7727.powershell-cmdlets-for-poweredge-servers
Import-Module DellPEPowerShellTools
$idracSession = New-PEDRACSession -Credential (Get-Credential) -IPAddress 192.168.100.1
$NicView = Get-CimInstance -ResourceUri 'http://schemas.dell.com/wbem/wscim/1/cim-schema/2/DCIM_NICView' -Namespace root\dcim -CimSession $idracSession
$NicView | Select DeviceDescription, DeviceNumber, EFIVersion, MediaType
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
@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
@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'
#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 />"