Windows: Difference between revisions
From Cheatsheet
Jump to navigationJump to search
No edit summary |
No edit summary |
||
| Line 2: | Line 2: | ||
== Important applications == | == Important applications == | ||
'''SSH''' | |||
* MobaxTerm - https://mobaxterm.mobatek.net/ | * MobaxTerm - https://mobaxterm.mobatek.net/ | ||
* Putty & Puttygen - https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html | * Putty & Puttygen - https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html | ||
'''Code''' | |||
VSCodium | |||
== Powershell == | == Powershell == | ||
| Line 34: | Line 37: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
==== | ==== Shutdown or restart ==== | ||
<syntaxhighlight lang='bash'> | |||
# Shutdown the computer | |||
shutdown /s | |||
# Restart the computer | |||
shutdown /r | |||
# Shutdown the computer in 200 seconds | |||
shutdown /t 200 | |||
# Abort a timed shutdown | |||
shutdown /a | |||
</syntaxhighlight> | |||
==== Windows Update ==== | |||
https://learn.microsoft.com/en-us/windows-server/administration/server-core/server-core-servicing | https://learn.microsoft.com/en-us/windows-server/administration/server-core/server-core-servicing | ||
<syntaxhighlight lang='bash'> | <syntaxhighlight lang='bash'> | ||
# | # Check current configured settings | ||
%systemroot%\system32\Cscript %systemroot%\system32\scregedit.wsf /AU /v | |||
# Disable automatic updates | |||
Net stop wuauserv | |||
%systemroot%\system32\Cscript %systemroot%\system32\scregedit.wsf /AU 1 | |||
Net start wuauserv | |||
# Enable automatic updates | |||
Net stop wuauserv | |||
%systemroot%\system32\Cscript %systemroot%\system32\scregedit.wsf /AU 4 | |||
Net start wuauserv | |||
# Update and install updates | |||
Wuauclt /detectnow | |||
</syntaxhighlight> | |||
==== Sysprep ==== | |||
# Download and install updates; | |||
# Restart; | |||
# Repeat step 1 and 2 until no more updates are available; | |||
# Set the proper timezone; | |||
# Set proper keyboard/region format; | |||
# Activate your license; | |||
# OPTIONAL: Make a snapshot before the sysprep | |||
# Perform a Sysprep (see commands below) | |||
<syntaxhighlight lang='bash'> | |||
# Sysprep | |||
C:\Windows\System32\Sysprep\sysprep.exe /generalize /shutdown | |||
# Sysprep using an unattend.xml | |||
C:\Windows\System32\Sysprep\sysprep.exe /generalize /shutdown /unattend:C:\Windows\System32\Sysprep\unattended.xml | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Revision as of 08:47, 8 September 2023
Important applications
SSH
- MobaxTerm - https://mobaxterm.mobatek.net/
- Putty & Puttygen - https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html
Code VSCodium
Powershell
Checks
# List open ports and related IP-addresses
Get-NetTCPConnection
# "To show only the listening ports we need to filter for all items in the Listen state with the remote address of 0.0.0.0"
get-nettcpconnection | where {($_.State -eq "Listen") -and ($_.RemoteAddress -eq "0.0.0.0")}
# "You can add additional fields like the process ID for each port. Changing the fields from the default requires selecting each one you want and then piping to ft (format-table)."
get-nettcpconnection | where {($_.State -eq "Listen") -and ($_.RemoteAddress -eq "0.0.0.0")} | Select LocalAddress,LocalPort,RemoteAddress,RemotePort,State,OwningProcess | ft
# "This example will get the name of the process associated with each item."
get-nettcpconnection | where {($_.State -eq "Listen") -and ($_.RemoteAddress -eq "0.0.0.0")} | select LocalAddress,LocalPort,RemoteAddress,RemotePort,State,@{Name="Process";Expression={(Get-Process -Id $_.OwningProcess).ProcessName}} | ft
# Test the network-connection to a specific IP and port
Test-NetConnection -ComputerName 192.168.200.20 -InformationLevel "Detailed" -Port 443
Common =
Commands
# Open User Management lusrmgr.msc
Shutdown or restart
# Shutdown the computer shutdown /s # Restart the computer shutdown /r # Shutdown the computer in 200 seconds shutdown /t 200 # Abort a timed shutdown shutdown /a
Windows Update
https://learn.microsoft.com/en-us/windows-server/administration/server-core/server-core-servicing
# Check current configured settings %systemroot%\system32\Cscript %systemroot%\system32\scregedit.wsf /AU /v # Disable automatic updates Net stop wuauserv %systemroot%\system32\Cscript %systemroot%\system32\scregedit.wsf /AU 1 Net start wuauserv # Enable automatic updates Net stop wuauserv %systemroot%\system32\Cscript %systemroot%\system32\scregedit.wsf /AU 4 Net start wuauserv # Update and install updates Wuauclt /detectnow
Sysprep
- Download and install updates;
- Restart;
- Repeat step 1 and 2 until no more updates are available;
- Set the proper timezone;
- Set proper keyboard/region format;
- Activate your license;
- OPTIONAL: Make a snapshot before the sysprep
- Perform a Sysprep (see commands below)
# Sysprep C:\Windows\System32\Sysprep\sysprep.exe /generalize /shutdown # Sysprep using an unattend.xml C:\Windows\System32\Sysprep\sysprep.exe /generalize /shutdown /unattend:C:\Windows\System32\Sysprep\unattended.xml
Network
# Add a route for a specific network route add 192.168.15.0 mask 255.255.255.0 192.168.15.1 # Delete a route for a specific network route delete 192.168.15.0 mask 255.255.255.0 192.168.15.1