Manage application installations on Windows. Install, uninstall and update on the command line.
Category Archives: Windows Commands
Create a local administrator account in windows on the command line
net user /add [username] [password]
This creates the user account
net localgroup administrators [username] /add
This adds the user to the Local Administrators Group
wmic UserAccount where Name="[username]" set PasswordExpires=False
This prevents the password from expiring
Using OpenSSH and SSH on Windows
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
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
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
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