Skip to content

Instantly share code, notes, and snippets.

View SQLtattoo's full-sized avatar

Vassilis Ioannidis - MTT [MSFT] SQLtattoo

View GitHub Profile
@SQLtattoo
SQLtattoo / ListRGVMsizes.ps1
Last active January 18, 2021 14:13
Retrieve a list of Azure VM and their VM Size in a specific Resource Group
function ListRGVMsizes($Rg, $VmSize)
{
if($Rg.Length -gt 0){
$VMs = Get-AzVM -ResourceGroupName $Rg
foreach($vm in $VMs){
if ($vm.HardwareProfile.VmSize -like "*"+$VmSize+"*"){
Write-host $vm.Name ": " $vm.HardwareProfile.VmSize
}
@SQLtattoo
SQLtattoo / resolveDomain.ps1
Last active November 2, 2021 08:33
PowerShell loop for DNS name lookup until resolved.
while(1 -eq 1) {
#get the IP of the domain assigned, by using the Cloudflare DNS server or replace with any other
$ip = Resolve-DnsName -Name <domain_name_here e.g. www.github.com> -Server 1.1.1.1 -Type A -ErrorAction SilentlyContinue -ErrorVariable procErr
#if there was an error then print a warning message
if($procErr){
Write-Warning "Not resolved!"
}
#if the IP is not null, means it was resolved successfully