Friday, June 3, 2022

Refine suggestions on Youtube

The sheer amount of content out on youtube is overwhelming. The suggestions might be personalized to your like by youtube but you still get bombarded with videos or channels on your page that you might have no interest in. Also this personalization requires you to login.It's also hard to block channels you don't want to see from popping up on your webpage.

This small extension called BlockTube on firefox helps in blocking content on your youtube page by.

Video title , Channel Name , Video ID , Channel ID 

There are other advanced options too.

Thursday, May 5, 2022

Useful Remote desktop setting registry keys

 

 Collection of registry settings to apply if you are having RDP issues. Use them at your own discretion after looking up the help for those.

REG ADD "HKLM\SYSTEM\CurrentControlSet\control\Terminal Server\Winstations\RDP-Tcp" /v 'SecurityLayer' /t REG_DWORD /d 0 /f
REG ADD "HKLM\SYSTEM\CurrentControlSet\control\Terminal Server\Winstations\RDP-Tcp" /v 'MinEncryptionLevel' /t REG_DWORD /d 1 /f
REG ADD "HKLM\SYSTEM\CurrentControlSet\control\Terminal Server\Winstations\RDP-Tcp" /v 'fQueryUserConfigFromLocalMachine' /t REG_DWORD /d 1 /f
REG ADD "HKLM\SYSTEM\CurrentControlSet\control\Terminal Server\Winstations\RDP-Tcp" /v 'KeepAliveTimeout' /t REG_DWORD /d 1 /f
REG ADD "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v 'KeepAliveEnable' /t REG_DWORD /d 1 /f
REG ADD "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v 'KeepAliveInterval' /t REG_DWORD /d 1 /f
REG ADD "HKLM\SYSTEM\CurrentControlSet\control\Terminal Server\Winstations\RDP-Tcp" /v 'fInheritReconnectSame' /t REG_DWORD /d 0 /f
REG ADD "HKLM\SYSTEM\CurrentControlSet\control\Terminal Server\Winstations\RDP-Tcp" /v 'fReconnectSame' /t REG_DWORD /d 1 /f
REG ADD "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v 'fDisableAutoReconnect' /t REG_DWORD /d 0 /f
REG ADD "HKLM\SYSTEM\CurrentControlSet\control\Terminal Server\Winstations\RDP-Tcp" /v 'fInheritMaxSessionTime' /t REG_DWORD /d 1 /f
REG ADD "HKLM\SYSTEM\CurrentControlSet\control\Terminal Server\Winstations\RDP-Tcp" /v 'fInheritMaxDisconnectionTime' /t REG_DWORD /d 1 /f
REG ADD "HKLM\SYSTEM\CurrentControlSet\control\Terminal Server\Winstations\RDP-Tcp" /v 'MaxConnectionTime' /t REG_DWORD /d 0 /f
REG ADD "HKLM\SYSTEM\CurrentControlSet\control\Terminal Server\Winstations\RDP-Tcp" /v 'fInheritMaxIdleTime' /t REG_DWORD /d 1 /f
REG ADD "HKLM\SYSTEM\CurrentControlSet\control\Terminal Server\Winstations\RDP-Tcp" /v 'MaxIdleTime' /t REG_DWORD /d 0 /f
REG ADD "HKLM\SYSTEM\CurrentControlSet\control\Terminal Server\Winstations\RDP-Tcp" /v 'MaxInstanceCount' /t REG_DWORD /d 4294967295 /f
REG ADD "HKLM\SYSTEM\CurrentControlSet\control\Terminal Server\Winstations\RDP-Tcp" /v 'MaxDisconnectionTime' /t REG_DWORD /d 0 /f

Wednesday, April 27, 2022

connect using ssh to Azure VM from powershell

If you are on windows 10 you can install the ssh client from Settings-Apps and Features.

During your VM creation in Azure it will ask to save the private key and if you have it saved. It might be with an extension of .pem.

Copy this private key to a directory where no one else has permissions except you. Or remove everyone from the security properties except yourself.

Open powershell and navigate to the directory where ssh is installed. 

Enter the command in the following format

.\ssh.exe -i C:\\ubuntukey.pem username@publicipfothevm

The username must have been created during the VM creation. 

The public ip can be seen in Azure portal.

 

If you dont have the VM username or key. You can reset the username and use your own public key using the following in command prompt.

 ssh-keygen.exe -m PEM -t rsa -b 4096.

This command will create two files in the directory you specify with extensions.  .pub and .pem

These are your pulic and privatekeys. Rename them to yourkey.pem and yourkey.pub.

Copy the contents of the .pub file and put that in the ssh public key section of reset password blade in Azure portal. Give an username you would like to be used as admin on the server.

user ssh.exe in the following format. 

ssh.exe -i c:\youdirectory\yourkey.pem username@publicipofthevm

Friday, March 25, 2022

बिकट वाट वहिवाट नसावी धोपट मार्गा सोडुं नको

 

Singer/Poet: Anant Phandi

बिकट वाट वहिवाट नसावी धोपट मार्गा सोडुं नको
Stay on a well traveled path. Don't go on a dangerous and unknown one.
संसारामधि ऐस आपुला उगाच भटकत फिरूं नको
Settle down in life instead of wandering around.
चल सालसपण धरुनि निखालस खोट्या बोला बोलुं नको
Be truthful.Don't lie every time.
अंगि नम्रता सदा असावी राग कुणावर धरूं नको.
Stay humble. Don't be angry on anyone.
नास्तिकपणांत शिरुनि जनाचा बोल आपणां घेउं नको
If you are an atheist. Don't tell that to people.
भली भलाई कर कांहीं पण अधर्ममार्गीं शिरूं नको
Do any kind of good deed but don't do any bad ones.
मायबापांवर रुसूं नको
Don't be upset with your parents and hold grudges.
दूर एकला बसूं नको
Always be in a company instead of sitting alone.
व्यवहारामधिं फसूं नको
In business dealings be careful.
कधीं रिकामा असूं नको
Don't sit idle any time. Always do something.
परि उलाढाली भलत्यासलत्या पोटासाठीं करूं नको
But don't do any bad deeds just for money.
वर्म काढुनी शरमायाला उणें कुणाला बोलुं नको.
Don't point out other peoples faults which may cause them to be ashamed.
बुडवाया दुसर्‍याचा ठेवा करुनी हेवा झटूं नको
Don't try to take anything deserved or reserved for someone else.
मी मोठा शहाणा जगामधि गर्वभार हा वाहुं नको
Don't think that you are the smartest around.
एकाहुनि एक चढी जगामधि थोरपणाला मिरवुं नको
There is always someone bigger than you.
हिमायतीच्या बळें गरिबगुरिबाला तूं गुरकावुं नको
If you have money don't be unkind to poor people.
दो दिवसांची जाइल सत्ता अपयश माथां घेउं नको
Failure is temporary. You will suceed eventually.
बहुत कर्जबाजारी हो‍उनि बोज आपुला दवडुं नको
Don't get loans which you cannot afford to pay.
स्‍नेह्यासाठीं पदरमोड कर परंतु जामिन राहुं नको
Lend money to friends. Don't be a guarantor.
विडा पैजेचा उचलुं नको
Don't offer to takeup challenges that other's won't.
उणी तराजू तोलुं नको
Measure everyones worth the same.
गहाण कुणाचें बुडवुं नको
If you borrow from someone. Always return it.
असल्यावर भिक मागुं नको
If you have it don't beg or borrow from someone.
नसल्यावर सांगणें कशाला गांव तुझा भिड धरूं नको
Don't lie and spread rumors.
कष्टाची बरि भाजिभाकरी तूपसाखरेचि चोरि नको
Eat food or money that you have earned with hardworkd.Don't steal.
दिली स्थिती देवानें तींतच मानीं सुख कधिं विटूं नको
If you are not happy with the state that you are in. Don't accept it saying it's fate.
आल्या अतिथा मुठभर द्याया मागेंपुढती पाहुं नको
If you have guests at home. Be very generous to them.
उगीच निंदास्तुती कुणाची स्वहितासाठीं करूं नको.
Don't say bad about someone just because it suits or benefits you.
बरी खुशामत शाहण्याची ही मूर्खाची ती मैत्रि नको
It better to be subservient to a good person that being friends with a fool.
आतां तुज ही गोष्ट सांगतों सत्कर्मा ओसरूं नको
If you get a chance to do a good deed. Do it.
असल्या गांठीं धनसंचय कर सत्कार्यी व्यय हटूं नको
Make sure you have saved enough first before spending for a good cause.
सुविचारा कातरूं नको
If you have a chance to hear something useful.Never miss it.
सत्संगत अंतरूं नको
If you get a chance to keep good company.Never miss it.
द्वैताला अनुसरूं नको
Dont worship false gods.
हरिभजना विस्मरूं नको
Don't forget to pray to God.
गावयास अनंतफंददिचे फटके मागें सरूं नको
If you get a chance to sing AnandPhandi's songs. Don't miss it.
सत्कीर्तिनौबदिचा डंका वाजे मग शंकाच नको
You good reputation will spread. There is no doubt.

Friday, February 25, 2022

Cannot open backup device. Operating system error 5(Access is denied.). RESTORE HEADERONLY is terminating abnormally. (Microsoft SQL Server, Error: 3201)

Came across this error while trying to restore a SQL database backup which was stored in a container to Azure SQL managed instance.

Operating system error 5(Access is denied.).
RESTORE HEADERONLY is terminating abnormally. (Microsoft SQL Server, Error: 3201)

The blob would connect properly and show the backup file.

Solution:

Deleted the stored credentials in the database and did the process again for restoring backup.





Monday, February 14, 2022

Service time out. Failed to start in time : ServicesPipeTimeout registry setting

Create the following DWORD registry key in on your Windows Server in.

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control

Name: ServicesPipeTimeout
Type: REG_DWORD
Data: The number of milliseconds that you want to give the services to start in.

 

I have entered 300000 which is 5 minutes.

 

 

 Here is a small script if you want to run this on multiple servers remotely.

$colComputers = @("GATEWAY1","GATEWAY2")

foreach ($strComputer in $colComputers)

 {
  #Open remote registry
  $reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $strComputer)
  #Open the targeted remote registry key/subkey for read and write ($True)
  $regKey= $reg.OpenSubKey("SYSTEM\CurrentControlSet\Control",$True)
  $regKey.Setvalue('ServicesPipeTimeout',300000, 'dword')
  $reg.Close
 }

 

Thursday, December 9, 2021

Firefox install add on error

Error: Unexpected error occurred while installing add ons in Firefox.


Fix: Create the following registry key if its not there. If its present, set the value of Default to 1

 

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Mozilla\Firefox\InstallAddonsPermission]
"Default"=dword:00000000

 

Thursday, December 2, 2021

Resize Azure VMs using Az powershell.

Script to resize Azure VM's from any subscription. If a VM is stopped it will resize it. If it is running it will stop the VM and resize it.


#$NewSize = "Standard_D8s_v3"

$NewSize = "Standard_E4s_v3" 

#$NewSize = "Standard_DS1_v2"

Function Out($message) {
$message = $(Get-Date -Format "MM/dd/yyyyTHH:mm:ss") + ":" + $message
Write-Output $message}

Out "Vm resize script starting...."

function Connect($tenantid)
{
$username = "username@contoso.com"
$password = ConvertTo-SecureString -AsPlainText -Force "password" 
$pscredential = New-Object -TypeName System.Management.Automation.PSCredential($username$password)
Connect-AzAccount -Credential $pscredential -Tenant $tenantId -EnvironmentName AzureUSGovernment
}

Function Resize-VM($VM)
{
 
  Out "Resizing $($vm.name) in $($vm.ResourceGroupName) from $($VM.HardwareProfile.VmSize) to $NewSize"          ## Change here
   $VM.HardwareProfile.VmSize = $NewSize
  Update-AzVM -ResourceGroupName $vm.ResourceGroupName -VM $VM 
}


Function CheckVM($VM)
{            
   if((Get-AzVM -Name $VM.Name -Status).PowerState -eq "VM running")
     {
       Out "$($VM.Name) is resized and Started"
     }
     else {
         Out "$($VM.Name) is resized and not started"
      }
     
}

Connect "put your tenant id here"


$VMList = @("VM1","VM2" ## comma separated list of VM's
)
$Allsubs = Get-AzSubscription 

foreach($sub in $Allsubs)

{
   Select-AzSubscription -SubscriptionId $sub.SubscriptionId | Out-Null
  $VMS = Get-AzVM -Status 
 
foreach($vm in $VMS)
{
 
 foreach($v in $VMList)
   {
     if($v -eq $Vm.name)
      {
        
      if($vm.PowerState -notmatch "VM running"## If the VM is switched off.We resize but dont start it.
        {
          #Resize the vm
          Out "VM $($VM.Name) is already powered off.Resizing...."
          Resize-VM $VM
          
        }

     Else # If the VM is turned on. Turn it off, resize and start it.
        {
          Out "VM is powered on. So Stopping $($VM.Name)"
          Stop-AzVM -Name $vm.Name -ResourceGroupName $vm.ResourceGroupName -Force
          Start-Sleep -Seconds 120
          #Get VM Status
          if((Get-AzVM -Name $VM.Name -Status).PowerState -eq "VM deallocated")
             {
               Out "$($VM.Name) is now off. Resizing...."
               Resize-VM $VM
               Start-AzVM -Name $VM.Name -ResourceGroupName $VM.ResourceGroupName
               Start-Sleep -Seconds 300
               CheckVM $VM

         }
                 
      }
   }
}

}
}