• Skip to main content

Uly.me

cloud engineer

  • Home
  • About
  • Archives

Windows

Convert PPK to PEM

September 2, 2021

Convert PPK to PEM format.

  1. Open Puttygen.
  2. Click Load in the Actions section.
  3. Select the PPK file you wish to convert.
  4. Go to the Conversions menu and select Export OpenSSH key.
  5. Click Yes to convert key without a password.
  6. Name your private key and save it with a .pem extension.
  7. Click Save.

Your pem file should begin with “—–BEGIN RSA PRIVATE KEY—–” and ends with “—–END RSA PRIVATE KEY—–.”

You can also use puttygen in Linux. Install it first.

$ sudo apt-get install putty-tools

$ sudo apt-get install putty-tools

Convert your key.

$ puttygen yourkey.ppk -O private-openssh -o yourkey.pem

$ puttygen yourkey.ppk -O private-openssh -o yourkey.pem

SSH to your server.

$ chmod 400 yourkey.pem
$ ssh -i yourkey.pem ec2-user@server-ip

$ chmod 400 yourkey.pem $ ssh -i yourkey.pem ec2-user@server-ip

Filed Under: Windows Tagged With: convert, pem, ppk, puttygen

GitBash Path

April 4, 2021

Open Git Bash. Change to the root directory of Git Bash.

cd ~
echo $PATH
/bin:/c/Program Files (x86)/Google/Cloud SDK/google-cloud-sdk/bin

cd ~ echo $PATH /bin:/c/Program Files (x86)/Google/Cloud SDK/google-cloud-sdk/bin

Edit .bash_profile or .bashrc. It was .bash_profile in my case. Showing a truncated path.

Add your custom path to the PATH variable. Save file. Exit Git Bash.

PATH="/bin:/c/Program Files (x86)/Google/Cloud SDK/google-cloud-sdk/bin:/c/custom/path"

PATH="/bin:/c/Program Files (x86)/Google/Cloud SDK/google-cloud-sdk/bin:/c/custom/path"

Open Git Bash again and check your updated Path.

echo $PATH

echo $PATH

Result.

/bin:/c/Program Files (x86)/Google/Cloud SDK/google-cloud-sdk/bin:/c/custom/path

/bin:/c/Program Files (x86)/Google/Cloud SDK/google-cloud-sdk/bin:/c/custom/path

Filed Under: Windows Tagged With: edit, git bash, path

Adding New Users in Powershell

December 23, 2020

Here’s an easy way to add Windows users in Powershell.

net user username 'password' /add

net user username 'password' /add

Passwords must meet requirements. While you are at it, give it Admin rights.

net localgroup Administrators username /add

net localgroup Administrators username /add

Filed Under: Windows Tagged With: admin, new, powershell, rights, users

Powershell Test Network Connection

June 15, 2020

Here’s the command to test a network connection in Powershell.

C:> Test-NetConnection -ComputerName server -Port 443

C:> Test-NetConnection -ComputerName server -Port 443

Result:

ComputerName     : server
RemoteAddress    : 10.0.0.5
RemotePort       : 443
InterfaceAlias   : Ethernet 0
SourceAddress    : 10.1.1.34
TcpTestSucceeded : True

ComputerName : server RemoteAddress : 10.0.0.5 RemotePort : 443 InterfaceAlias : Ethernet 0 SourceAddress : 10.1.1.34 TcpTestSucceeded : True

Filed Under: Windows Tagged With: port, powershell, test-netconnection, windows

GCE Agent Powershell

May 11, 2020

This is a Powershell script to restart a service if it’s down.

$ServiceName = 'GCEAgent'
$arrService = Get-Service -Name $ServiceName
 
if ($arrService.Status -ne 'Running')
{
 
    Start-Service $ServiceName
    write-host $arrService.status
    write-host 'Service starting'
    Start-Sleep -seconds 60
    $arrService.Refresh()
    if ($arrService.Status -eq 'Running')
    {
        Write-Host 'GCE Agent Service is now Running'
    }
 
}
else
{
    Write-Host 'GCE Agent Service is Running'
}

$ServiceName = 'GCEAgent' $arrService = Get-Service -Name $ServiceName if ($arrService.Status -ne 'Running') { Start-Service $ServiceName write-host $arrService.status write-host 'Service starting' Start-Sleep -seconds 60 $arrService.Refresh() if ($arrService.Status -eq 'Running') { Write-Host 'GCE Agent Service is now Running' } } else { Write-Host 'GCE Agent Service is Running' }

Filed Under: Cloud, Windows Tagged With: check, powershell, restart, service

Windows Route Add

January 14, 2020

Here’s how to add a route in Windows. Open CMD as Administrator.

route add 10.10.10.10 mask 255.255.255.0 10.10.10.254

route add 10.10.10.10 mask 255.255.255.0 10.10.10.254

To make it persistent, add -p.

route add 10.10.10.10 mask 255.255.255.0 10.10.10.254

route add 10.10.10.10 mask 255.255.255.0 10.10.10.254

To display. Specifies IP 4 only.

route print -4

route print -4

Filed Under: Windows Tagged With: add, display, permanent, persistence, print, route, server, windows

Get-Hotfix

December 10, 2019

How to find out if a Windows Server was last patched.

From Powershell, run this command.

get-hotfix

get-hotfix

From the command line, run this command.

C:\> systeminfo.exe

C:\> systeminfo.exe

Or from the menu, follow these steps.

Open the Windows Settings UI.
Click on Update & security.
Click on the "Update history" link located under the Windows Update tab.

Open the Windows Settings UI. Click on Update & security. Click on the "Update history" link located under the Windows Update tab.

Filed Under: Windows Tagged With: get-hotfix, history, info, patch, systeminfo, update

Windows Boot Time

December 2, 2019

Here’s how to find when a Windows server was last rebooted.

systeminfo | find /i "boot time"

systeminfo | find /i "boot time"

Filed Under: Windows Tagged With: boot, cmd, last, server, windows

  • Go to page 1
  • Go to page 2
  • Go to Next Page »
  • Home
  • About
  • Archives

Copyright © 2023