Skip to content

Instantly share code, notes, and snippets.

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

Kiran Patnayakuni kpatnayakuni

🏠
Working from home
View GitHub Profile
$AvailableContexts = Get-AzContext -ListAvailable
$AllSQLServers = foreach ($Context in $AvailableContexts)
{
$SqlServer = Get-AzSqlServer -DefaultProfile $Context
if ($SqlServer)
{
$SqlServer | ForEach-Object { Add-Member -InputObject $_ -MemberType NoteProperty -Name Context -Value $Context }
}
$SqlServer
@kpatnayakuni
kpatnayakuni / WT-settings.json
Created September 8, 2020 13:47
My Windows Terminal Settings
// This file was initially generated by Windows Terminal 1.2.2381.0
// It should still be usable in newer versions, but newer versions might have additional
// settings, help text, or changes that you will not see unless you clear this file
// and let us generate a new one for you.
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
"$schema": "https://aka.ms/terminal-profiles-schema",
## Function to generate a random word of a fixed or random length
function Get-RandomWord
{
[CmdLetBinding()]
param
(
# Include diacritical letters
[Parameter(Mandatory = $false)]
[switch] $IncludeDiacriticalLetters,
@kpatnayakuni
kpatnayakuni / gist:5cbf74a575a6a90a33ebccf19e6b8183
Created July 5, 2020 07:02 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@kpatnayakuni
kpatnayakuni / Switch-AZContext.ps1
Last active May 29, 2020 09:28 — forked from JustinGrote/Switch-AZContext.ps1
A helper command to quickly switch current Azure Contexts
using namespace System.Management.Automation.Host
function Switch-AzContext
{
[CmdLetBinding(DefaultParameterSetName = 'By Context')]
param (
[Parameter(ParameterSetName = 'By Name')]
[Alias('Context', 'ContextName')]
[ValidateNotNullOrEmpty()]
[ArgumentCompleter( {

On Remote Server

The below commands shold be executed with elevated privelges

  1. Remote Computer should have static ip and porper name set
    • To see the ip address

      • Get-NetIpAddress
      • Get-NetIPConfiguration
    • To create a new ip

      • New-NetIpAddress
<#
.SYNOPSIS
Gets row count difference.
.DESCRIPTION
Gets row count difference between two identical databases from two different servers.
.PARAMETER Server1Name
Specify Server1 name, this is a mandatory parameter.
$web = New-Object System.Net.WebClient
$web.UseDefaultCredentials = $true
$web.Proxy.Credentials = $web.Credentials
$web.DownloadString("https://pomber.github.io/covid19/timeseries.json") | ConvertFrom-Json | ForEach-Object India | Select -Last 1
$web = New-Object System.Net.WebClient
$web.UseDefaultCredentials = $true
$web.Proxy.Credentials = $web.Credentials
$web.DownloadString("https://pomber.github.io/covid19/timeseries.json") | ConvertFrom-Json | ForEach-Object India | Select -Last 1
@kpatnayakuni
kpatnayakuni / Copy-AzNSGRules.ps1
Last active January 15, 2024 20:02
Copy Azure NSG Security Rules from one NSG to another
Function Copy-AzNSGRules
{
<#
.SYNOPSIS
Copies Azure NSG security rules from one NSG to another
.DESCRIPTION
Copies all the Azure Network Security Group security rules