How do I run win32-openssh through the powershell? (installed with install-package from chocolatey provider) - powershell

So I am just trying to convert to powershell from bash. I was trying to find a way to SSH my server, and found out I could install win32-openssh to do so.
I installed it by:
Installing chocolatey as packageprovider using:
install-packageprovider chocolatey
Then i installed win32-openssh with the command:
install-package win32-openssh
My problem is now, how do I run this program?

It installs the correct binaries etc. It will not add some PS cmdlets for the use off ssh inside PS.
It is all described on the package site:
This package performs the following operations that you normally have to hack at until you get what you want:
Install Appropriate Bitness for the version of Windows
Install to Program Files (malware protection and following advice of dev team)
Add SSH location to System PATH
Optionally install sshd windows service (Requires parameter - see below)
Optionally install sshd server "key based authentication" (Requires parameter - see below)
Cleanly uninstall all of the above (removing config files and server keys requires special switch - see below)
So you can run it from start menu, or by typing ssh.exe into a prompt.

You have Two Options I can think of.
Option 1 : Use bash on Windows 10. Bash comes bundled with Windows 10. You can just enable a Windows 10 feature for it. Setup bash on Windows 10. You'll never miss bash again even if you're on Windows. [Recommended Option]
Option 2 : Set up SSH on Powershell by installing a package like PoSH-SSH.
Steps :
Pre-requisite : PC running Windows 10. Open PowerShell in Admin mode.
Find-Module PoSH-SSH
type 'Y' for the prompts.
Install-Module Posh-SSH
type 'A' for the prompts.
Reference:
https://www.thomasmaurer.ch/2016/04/using-ssh-with-powershell/

There's not really a need for this. If you have git installed on your Windows machine, you can add it's usr/bin folder to you path. It has ssh and other Unix tools you can use just like in Bash in PowerShell or CMD.

Related

have problems installing plugins in neovim/vim

Whenever i install any plugin in neovim/vim, the commands don't work, neovim/vim gives me the same error saying that the command that the plugin has isn't a command. Am i doing something wrong?
For more info, i use windows 10 (want to switch to linux but i don't have a computer of my own to do so). I checked everything i installed, they have a windows version, they have instructions on how to download it on windows, i followed them, but the plugins still refuse to work.
The first thing i installed is vim-plug. But no command i enter works.
I tried re-installing, but that doesn't work either.
You have first to install vim-plug.
On Windows 10 you have to start a powershell (WinpowershellEnter) run the following command:
iwr -useb https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim |`
ni "$(#($env:XDG_DATA_HOME, $env:LOCALAPPDATA)[$null -eq $env:XDG_DATA_HOME])/nvim-data/site/autoload/plug.vim" -Force
You need to have the following lines in your ~\AppData\Local\nvim\init.vim
call plug#begin()
Plug 'nvim-tree/nvim-web-devicons' " optional, for file icons
Plug 'nvim-tree/nvim-tree.lua'
call plug#end()
You need to start Neovim and run:
:PlugInstall
You need to restart Neovim

OpenSSH not working on windows server 2016

I have managed to install the OpenSSH on my windows server and am able to ssh from my computer. But I am facing some weird issues after ssh into the server. When I try to move around like running cd it works but when I try to create a file and etc it prompted me that the command is invalid.
I have used this tutorial to set up the OpenSSH on my windows server.
Is powershell installed on your server?
Looks like powershell is not installed.
What I see now, you are connected with regular cmd, not with powershell.
Try to start Powershell first

Open folder in Visual Studio code in WSL with "code"

My computer crashed and I had to reinstall my system today.
I'm running Windows 10 with VS Code and I'm using Debian (WSL) as my main terminal.
I have installed VS Code with the "Add to PATH" option and I have activated the Windows Subsystem for Linux in PowerShell.
I can use the command "code" in CMD and PowerShell but when I try to run it in Debian I get
"-bash: code: command not found", as far as I understand it should work straight away when installing with the "path" option? At least according to this article: https://dev.to/ajeet/the-ultimate-guide-to-use-vs-code-with-windows-subsystem-for-linux-wsl-51hc
I have also tried installing the "Remote Development" extension, but I'm still facing the same problem.
Try adding the following line to the .bashrc file in your $HOME directory (~/.bashrc).
PATH=$PATH:/mnt/c/Users/$USER/AppData/Local/Programs/Microsoft\ VS\ Code/bin
Where you replace $USER with your Windows username.
Alternatively, you can create an alias and add it to your .bashrc file:
alias $COMMAND"$PATH"
Where you replace $COMMAND with a name of your choice and $PATH with the path to the executable.
You can set an alias in bashrc like:
alias code='code --remote wsl+<distro_name>'
Where distro_name is your WSL distro name.
You can check your distro name in PowerShell by using:
wsl --list
Refer to the documentation.

Install NewSSHSession offline server - powershell

I'm trying to install a posh-ssh on my offline env so i can create ssh connection via powershell.
i went to this website:
https://www.powershellgallery.com/packages/Posh-SSH/2.0.2
seems like it has the files i need inside, but i'm not sure how to install it.
any ideas? or this is the wrong link?
back then i used the following command:
find-module PoSH-SSH | Install-Module
but now its not working (since im not connected to the internet).
thanks in advance.
It;s a comprsssed archive. Just unzip it into a folder called "POSH-SSH".
Place the folder in your modules directory which you can find by typing
$env:PSModulePath
To install for all users, place it in C:\Program Files\WindowsPowershell\Modules (for 64bit)
Then just Import-Module as usual
Thanks to Scepticalist i made some google and found this article
https://fileinfo.com/extension/nupkg
the following softwares can open this file:
Microsoft Visual Studio with NuGet extension
Microsoft File Explorer
7-Zip
Corel WinZip 23
WinRAR 5
Thanks for the help.
Are you aware that Windows 10 has SSH built in since v1809? An OpenSSH-Client is already installed, you can directly use it by calling ssh. There is also an OpenSSH-Server available, but has to be enabled as a feature first.
MS documentation on enabling OpenSSH-Server

Can't install PostgreSQL: An error occurred executing the Microsoft VC++ runtime installer on Windows XP

I downloaded installer postgresql-9.0.1-1-windows.exe from the official site, ran it, and then got an error:
An error occurred executing the Microsoft VC++ runtime installer
What is the reason for this error message?
Platform: Windows XP SP3, Dell Inspiron 1501. Processor: AMD Sempron 3500+
One of the reasons this can happen is because the installer attempts to install an older version of the VC++ runtime than what you are currently using.
See this installation log, found in your user's temporary directory (e.g. dd_vcredist_amd64_20190214193107.log):
[20C0:20E4][2019-02-14T19:31:07]e000: Error 0x80070666: Cannot install a product when a newer version is installed.
A workaround is to prevent the runtimes from installing with the --install_runtimes option:
postgresql-9.6.12-1-windows-x64.exe --install_runtimes 0
Create a shortcut of the downloaded file:
Right click of the shortcut → Properties → Shortcut. Add --install_runtimes 0 to the end of the file path:
Create a shortcut of your EXE file;
right click on the shortcut → add --install_runtimes 0 at the end of the target path, e.g.:
postgresql-9.3.1-1-windows-x64.exe --install_runtimes 0
save and run it :)
I was having a similar issue and found a fix that worked for me from Garrett_H in this forum post:
http://forums.enterprisedb.com/posts/list/1747.page#6180
Go to file %windir%\inf\wsh.inf, right click and select 'Install'
re-run postgresql installer
I'm running Windows XP Pro, and I was trying to install postgresql-8.3.17-1-windows.exe. I originally received the following error:
An error occurred executing the Microsoft C++ runtime installer.
First download and install Microsoft Visual C++ from the Microsoft website. Then run the installation from command with --install_runtimes 0.
In my case, when I was installing postgresql-11.0-1-windows-x64.exe on Windows 10, I had faced the same problem.
I just uninstalled the Microsoft Visual C++ Redistributable (the latest one for both 32 and 64 bit) and then tried to install postgresql-11.0-1-windows-x64.exe again, and it worked for me.
I too faced the same issue. I fixed it in the following way:
I visited the below site:
https://www.enterprisedb.com/downloads/postgres-postgresql-downloads
Choose the Download button under PostgreSQL Version 11.1 for Windows x86-64.
In one word, just try to install the latest version.
Try installing as administrator (using Run as administrator).
In version 9.0. PostgreSQL can be installed as a Windows administrator :)
Check if Windows Script Host (WSH) is enabled. If not enabled, details are here: PostgreSQL Installation Problem on Windows without WSH
Take special care that your Windows user's folder name does not contain spaces. PostgreSQL (as of version 9.2.2.1) handles that poorly. If I use this account on Windows XP, installation fails with the "An error occurred executing the Microsoft C++ runtime installer" message:
"C:\Documents and settings\Jimmy (admin)"
But it runs just fine with this:
"C:\Documents and settings\Jimmy-admin"
The spaces in "Documents and settings" don't seem to bother the installer. Go figure.
Go to file %windir%\inf\wsh.inf, right click, and select 'Install'.
Then re-run the PostgreSQL installer.
This works on Windows XP with PostgreSQL 8.4.17-1.
Windows Script Host (WSH) is unable to execute VBScript scripts. This can occur if the scripting host is disabled (which is unusual), or if the installation is broken. A sign of this problem is a message like
CScript Error: Can't find script engine "VBScript" for script "C:....
It can often be resolved by re-registering the VBScript interpreter, click Start * → * Run and enter the following and click OK:
regsvr32 %systemroot%\system32\vbscript.dll
I had the same problem while trying to install PostgreSQL version 11.1. I had to uninstall the Microsoft VC++ and run the installer again. It downloaded the required VC++ and the installation went successful.
I had these same problems and tried
manually installing MS VC++
bypassing VC++ installation on postgres
fixing windows update service
Still unsuccessful
Then I solved these problem by installing postgres manually:
extract the PostgreSQL installation contents to C:\PostgreSQL (you can copy from successful installation on other machines)
add C:\PostgreSQL\bin to PATH environment
run pg_ctl register -D D:\pgdata -N postgresql -U postgres -P <your postgres password>