Category Archives: Windows Commands

Windows tools available on the command line

Using OpenSSH and SSH on Windows

Published by:

Secure Shell software allowing connections between clients and servers for remote administration.

Related Powershell Commands:
Check the installation status
Get-WindowsCapability -Online | Where-Object Name -like 'OpenSSH*'

Start the service
Start-Service sshd

Change the service startup behaviour
Set-Service -Name sshd -StartupType 'Automatic'

Add/Install the service
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
Local Tunneling allows a port on your local client machine to act as a port on the remote server.
Jump to remote tunnel at 7m 43 secs
Useful Commands to show the logged in user account etc:

tasklist /s <pcname> /fi "imagename eq explorer.exe" /v

wmic /node: <pcname> computersystem get username

wmic /node: <pcname> computersystem get manufacturer, model, username

Or locally:
wmic computersystem get manufacturer, model, username

Change the Network Hostname (Requires Admin account)
Using CMD
wmic computersystem where name="%COMPUTERNAME%" rename "NewName"

Use Powershell and CMD to switch between sessions on either command line  

Using Powershell
Rename-Computer "NewName" -Restart

Windows cURL on the command line

Published by:

Command line and scripting tool for transferring data with URLs see the website Curl.se

curl -L -A "Mozilla" http://website.com

This follows re-directs and uses a dummy header to anticipate 406 Not Acceptable errors then returns the page content, you can use a full header string to represent other browsers

This YouTube video is presented by the cURL creator

Windows Robocopy command common usage issues problems & gotchas

Published by:

Enclosing the source or destination in double quotes allows the use of paths with spaces in the folder names but DO NOT end with a trailing backslash ‘\’ as this will be interpreted as an escape character.

When using the task scheduler to run a robocopy command script be aware that using the account credentials of the logged-in user may be necessary for access to network drives referred to by the command. An administrator account may not have the necessary permissions.

Syntax
      ROBOCOPY Source_folder Destination_folder [files_to_copy] [options]

      ROBOCOPY "M:\" "X:Destination Folder\" DON'T USE EITHER OF THESE

      ROBOCOPY M:\ "X:Destination Folder" THIS WORKS