Skip to main content

Posts

Reset Azure SSH Key because of SSH Key Refused error

SSH Key Refused error, is a common error if the Private key is not accepted by the system in which the other end wants to connect with or communicate. In Microsoft Azure, the VM will through an error in Putty or any application software that will be used to connect or login to the VM on Azure cloud. If the private key is not recognized or accepted by the VM. Luckily, MS Azure provides an option to reset the SSH key and generate a new one. However, when the VM is created a PEM file will be generated and the user must download this file and keep it securely. Using PuttyGen or Putty Generator the PEM can be file can be used to generate a Public Key and a Private Key. To reset SSH or resolve the Server Key Refused error, a Public Key is needed or required by Azure. Screen shot below shows, on how to reset the SSH Public key. First, select the Virtual Machine that the SSH key needs to be resetted or changed. Upon selecting the Virtual Machine, choose or select the "Reset Password"...

WMIC restart wireless network via command line in Windows

How to restart WiFi or Wireless using command line in Windows? If the wireless devices, laptops or computers are connected to a domain such as active directory, or a centralized control. The command below can be created using a batch file and deploy to all controlled devices or computers. The command below, has been tested on a Windows 11 laptop and works fine. If nothing goes wrong, the command executes very fast. Here's the command, must be executed on an elevated command prompt or administrator prompt. wmic service where caption="WLAN AutoConfig" call stopservice && timeout 3 && wmic service where caption="WLAN AutoConfig" call startservice Timeout command is used in between stop and start, as this would give the first command to stop the service and after 3 seconds, another command is executed to start the service. Without the timeout command, the second command might not run  properly, since the first is still executed on the background. Jus...

How to view windows folder in GB or MB or in human readable sizes

With the era of WSL, Windows Subsystem for Linux is quite helpful. You can now run Linux commands on Windows with ease, or without installing any virtualization software. Of course, having VirtualBox installed with Linux is a different story, since you can have a pure Linux environment. Anyway, WSL provides an easy way to view size or capacity of Windows folder without any scripting using PowerShell or installing any Sysinternal tools. How to view folder sizes in human readable format in Windows using WSL? If WSL has been installed and working correctly, open Windows Terminal an awesome command-line shell application, in which you can run multiple Windows in one screen. And you can also position different windows terminal, either horizontally or vertically and Terminals can be resized the way you wan it. Grab windows terminal from Microsoft Store and for the prize of free. Once the Windows Terminal is open, just cd or browse to the directory where you need to check folder sizes. Just p...

How to rip or convert old auido CDs to MP3 or digital format

Old habits are hard to break as they said, however, music of your generation old favorites music of yesteryears will always stay with you. Such music, are hard to forget since the mold your young life or even such songs inspired you to get through difficult times and be who you are today. Or just simply a music of wonderful memories with friends and love ones. Anyway, how to convert or rip CDs to digital format such MP3, WMA,  M4A or any other format that the converter supports. To convert CDs, a CD drive or reader is needed. A built-in CD drive or an external USB-Disk Drive that can read CDs or DVDs. In Windows 11 or Windows 10, these are the steps: Step 1: Insert the Audio CD to the drive Step 2: In the search are beside the windows logo, type: Media and from the search result choose or select the "Media Player". Step 3: In the top left hand side of the Media Player, you will see the Album of the insert CD, it will either show the album name, or if Media Player will not be ...

PowerShell query event log last reboot or shutdown

Querying when was the last time the server  or computer is  essential in troubleshooting or auditing the server. Or in production system, computers or servers, must scheduled a downtime and let stakeholders know that at this specific date and time there will be a down time and services will not ne available at the said time and date. Even in development servers or computers, checking when was the last time the computer restarted or shutdown is quite essential. If the application is buggy,  or has some memory leak or other issues then it will cause the system to reboot, shutdown or crash. PowerShell comes in handy in querying event log; when was the last time the computer has shutdown or rebooted. Of course, event log can be checked manually. But scrolling through the 100 or thousands of event logs is quite tedious. So, PowerShell comes to a rescue  and avoid the tedious, manual finding of the event log. Here's a sample code snippet on how to query Windows event log w...

PowerShell Compare and Get Hash File

 Hash File comparison is a good thing to do, to make sure that file in transit, transferred, downloaded, or copied over is not corrupted or has been altered or modified. PowerShell has a built-in module to do this that makes life easier and an easy task to do. Here's an example code snippet to do this: #Path location of the file $file="C:\Users\User1\Downloads\Win10_22H2_EnglishInternational_x64.iso" # Get the file hash $hashSrc = Get-FileHash $file -Algorithm "SHA256" write-output $hashSrc #copy the Hash file  $Display_hash_only = $hashSrc | Select-Object -Property Hash | ft -HideTableHeaders Write-Output $Display_hash_only Output of the write-output $hashSrc command, will show the Algorithm used, the Hash of the file and path location of the file. Algorithm : SHA256  Hash: AC5522F9DB9F4F432A1AADE69FEF268C8C0B5FD3F22D3A6987719752F8A7108   Path : C:\Users\User1\Downloads\Win10_22H2_EnglishInternational_x64.iso  After getting the Hash File run this code...

Unable to login to SSH even with a correct password

 In Linux world, SSH is a life. Especially, now with remote work, data center, servers without graphical interface. If you can't login via SSH,  even with a correct password but other user accounts is able to login. Then the person need to check with HR whether he or she is still on the payroll. :)  😄 Of course, glitch, errors and other issues will always be a part of this technology. Nothing is perfect in this world, so errors, technological issues will always be there it won't go away. So, what will will you do if you are sure that the SSH password and username is correct? Like you can login to Server 1, Server 2 but unable to login with Server 3 using the same credentials? If other users with sudo credentials are still able to login, the sudo account can be used to troubleshoot the specific SSH account that is having the issue. What would be the first thing to do? Well, joke as it seems that "restart works always" but the reality is not far from there. Restart SSH...

Create an admin account on Azure VM to reset forgotten password

How to create an administrator account on Azure VM? On Azure environment, username and password of the authorized account is needed in order to login or connect via Remote Desktop. If the administrator password or the password to RDP has been forgotten, then logging in to the VM will be an issue. How to resolve this kind of issue? PowerShell is a friend for this kind of dilemma. Code snippet below will create a user account, and set the created account as a member of the administrator group. # Create a user account   $username = "azure_admin_22" $password = ConvertTo-SecureString "Dynamic_Admin_User_2022" -AsPlainText -Force New-LocalUser -Name "$username" -Password $password -FullName "$username" -Description "User Description"   # Add the user to "Administrators" groups Add-LocalGroupMember -Group "Administrators" -Member azure_admin_22 User account that will be created is: azure_admin_22 with the pass...