> wmic computersystem get manufacturer
anufacturer
Supermicro
serial number
> wmic bios get serialnumber
SerialNumber
Sxxxxxxxxxxxxx2
> wmic csproduct get IdentifyingNumber
IdentifyingNumber
Sxxxxxxxxxxxxx2
product name
> wmic computersystem get model,name,manufacturer,systemtype
> wmic computersystem get Model,Name,Manufacturer,SystemType,SystemFamily,SystemSKUNumber
Manufacturer Model Name SystemFamily SystemSKUNumber SystemType
LENOVO 20T1S4L10K SC-L*****0 ThinkPad T14s Gen 1 LENOVO_MT_20T1_BU_Think_FM_ThinkPad T14s Gen 1 x64-based PC
uuid
> wmic csproduct get uuid
UUID
00000000-0000-0000-0000-0xxxxxxxxxxx
system slot
> wmic systemslot get slotdesignation,currentusage,description,status
CurrentUsage Description SlotDesignation Status
4 System Slot RSC-R1UW-2E16 SLOT1 PCI-E X16 OK
3 System Slot RSC-R1UW-2E16 SLOT2 PCI-E X16 OK
3 System Slot RSC-R1UW-E8R SLOT1 PCI-E X8 OK
4 System Slot AOC-URN2-i4GXS SLOT1 PCI-E 3.0 X8 OK
cpu
> wmic cpu get DeviceID,NumberOfCores,NumberOfLogicalProcessors,Manufacturer,Name,ProcessorId
DeviceID Manufacturer Name NumberOfCores NumberOfLogicalProcessors ProcessorId
CPU0 GenuineIntel Intel(R) Xeon(R) CPU E5-2667 v4 @ 3.20GHz 8 16 BFEBFBFF000406F1
CPU1 GenuineIntel Intel(R) Xeon(R) CPU E5-2667 v4 @ 3.20GHz 8 16 BFEBFBFF000406F1
REM or
> wmic cpu get SocketDesignation, NumberOfCores, NumberOfLogicalProcessors /Format:List
NumberOfCores=8
NumberOfLogicalProcessors=16
SocketDesignation=CPU1
NumberOfCores=8
NumberOfLogicalProcessors=16
SocketDesignation=CPU2
REM or
> echo %NUMBER_OF_PROCESSORS%
32
> wmic os get Caption,CodeSet,Manufacturer,OSArchitecture,SerialNumber
Caption CodeSet Manufacturer OSArchitecture SerialNumber
icrosoft Windows Server 2016 Standard 1252 Microsoft Corporation 64-bit 003xx-6xxxx-00000-AAxxx
> wmic diskdrive get model,index,firmwareRevision,status,interfaceType,totalHeads,totalTracks,totalCylinders,totalSectors,partitions
FirmwareRevision Index InterfaceType Model Partitions Status TotalCylinders TotalHeads TotalSectors TotalTracks
4.68 1 SCSI AVAGO SMC3108 SCSI Disk Device 2 OK 933617 255 14998557105 238072335
4.68 0 SCSI AVAGO SMC3108 SCSI Disk Device 3 OK 117242 105 467795580 12310410
via diskpart
> diskpart
DISKPART> list volume
Volume ### Ltr Label Fs Type Size Status Info
---------- --- ----------- ----- ---------- ------- --------- --------
Volume 0 E New Volume NTFS Simple 7151 GB Healthy
Volume 1 System Rese NTFS Partition 500 MB Healthy System
Volume 2 C NTFS Partition 221 GB Healthy Boot
DISKPART> list disk
Disk ### Status Size Free Dyn Gpt
-------- ------------- ------- ------- --- ---
Disk 0 Online 223 GB 0 B
Disk 1 Online 7151 GB 0 B * *
DISKPART> select disk 0
Disk 0 is now the selected disk.
DISKPART> detail disk
AVAGO SMC3108 SCSI Disk Device
Disk ID: 000B6070
Type : RAID
Status : Online
Path : 1
Target : 0
LUN ID : 0
Location Path : PCIROOT(0)#PCI(0200)#PCI(0000)#RAID(P01T00L00)
Current Read-only State : No
Read-only : No
Boot Disk : Yes
Pagefile Disk : Yes
Hibernation File Disk : No
Crashdump Disk : Yes
Clustered Disk : No
Volume ### Ltr Label Fs Type Size Status Info
---------- --- ----------- ----- ---------- ------- --------- --------
Volume 1 System Rese NTFS Partition 500 MB Healthy System
Volume 2 C NTFS Partition 221 GB Healthy Boot
DISKPART> select disk 1
Disk 1 is now the selected disk.
DISKPART> detail disk
AVAGO SMC3108 SCSI Disk Device
Disk ID: {057A21CC-17C6-45E2-893C-D68B128CAD35}
Type : RAID
Status : Online
Path : 1
Target : 1
LUN ID : 0
Location Path : PCIROOT(0)#PCI(0200)#PCI(0000)#RAID(P01T01L00)
Current Read-only State : No
Read-only : No
Boot Disk : No
Pagefile Disk : No
Hibernation File Disk : No
Crashdump Disk : No
Clustered Disk : No
Volume ### Ltr Label Fs Type Size Status Info
---------- --- ----------- ----- ---------- ------- --------- --------
Volume 0 E New Volume NTFS Simple 7151 GB Healthy
mac address
> getmac
Physical Address Transport Name
=================== ==========================================================
AC-xx-xx-xx-xx-xx Media disconnected
N/A Hardware not present
0C-xx-xx-xx-xx-xx \Device\Tcpip_{BxxxxxxA-3xx1-4xxF-8xx5-3xxxxxxxxxxA}
process
get the list of programs (wmic)
[12:26:33.40 C:\Windows\SysWOW64]
$ wmic product get name,version
Name Version
ALM-Platform Loader 11.5x 11.52.444.0
icrosoft Lync Web App Plug-in 15.8.8308.577
Google App Engine 1.8.6.0
icrosoft Office Professional Plus 2010 14.0.6029.1000
icrosoft Office OneNote MUI (English) 2010 14.0.6029.1000
...
ps auxf
tasklist
> tasklist
Image Name PID Session Name Session# Mem Usage
========================= ======== ================ =========== ============
System Idle Process 0 Services 0 4 K
System 4 Services 0 8,236 K
smss.exe 520 Services 0 1,164 K
csrss.exe 864 Services 0 4,340 K
wininit.exe 960 Services 0 4,744 K
csrss.exe 968 Console 1 11,396 K
services.exe 108 Services 0 7,776 K
lsass.exe 96 Services 0 22,176 K
CoordMode, Mouse, Screen
Loop
{
; Move mouse
MouseMove, 1, 1, 0, R
; Replace mouse to its original location
MouseMove, -1, -1, 0, R
; Wait before moving the mouse again
Sleep, 600000
}
return
> whoami /user
USER INFORMATION
----------------
User Name SID
================ ===============================================
mj\marslo_jiao S-1-5-21-354581543-3608027983-2995495404-970613
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Windows\Sidebar]
"TurnOffSidebar"=-
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Windows\Sidebar]
"TurnOffSidebar"=-
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Office\16.0\Common\ExperimentConfigs\ExternalFeatureOverrides\outlook]
"Microsoft.Office.Outlook.Hub.HubBar"="false"
> mklink /d c:\Users\marslo\pbustor \\dc1engcifs.sample.com\pbu_sdk_stor
symbolic link created for c:\Users\marslo\pbustor <<===>> \\dc1engcifs.sample.com\pbu_sdk_stor
# set Windows Update Server Key to 0
> Set-ItemProperty -Path HKLM:SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU -Name UseWUServer -Value 0
# Set Disable Windows Update Access to 0
> Set-ItemProperty -Path HKLM:SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\ -Name DisableWindowsUpdateAccess -Value 0
# restart Windows Update Service
> Restart-Service -Name wuauserv -Force
or full process
# get defautl values
> $currentWU = Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" -Name "UseWUServer"
> $currentWUAccess = Get-ItemPropertyValue -Path "HKLM:SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -Name "DisableWindowsUpdateAccess"
# set Windows Update Server Key to 0
> Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" -Name "UseWUServer" -Value 0
# set Disable Windows Update Access to 0
> Set-ItemProperty -Path HKLM:SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate -Name DisableWindowsUpdateAccess -Value 0
# restart Windows Update Service ( wuauserv )
> Restart-Service wuauserv
# or
> Restart-Service -Name wuauserv -Force
# install
> Get-WindowsCapability -Name OpenSSH* -Online | Add-WindowsCapability –Online
# or
> dism /online /Add-Capability /CapabilityName:OpenSSH.Client~~~~0.0.1.0
> dism /online /Add-Capability /CapabilityName:OpenSSH.Server~~~~0.0.1.0
# or
> Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0
> Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
# revert
> Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" -Name "UseWUServer" -Value $currentWU
> Set-ItemProperty -Path HKLM:SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate -Name DisableWindowsUpdateAccess -Value $currentWUAccess
> Restart-Service wuauserv
# or
> Restart-Service -Name wuauserv -Force
# Start the sshd service
> Start-Service sshd
> Start-Service ssh-agent
# OPTIONAL but recommended:
> Set-Service -Name sshd -StartupType 'Automatic'
> Set-Service -Name ssh-agent -StartupType 'Automatic'
# confirm the firewall rule is configured. it should be created automatically by setup. run the following to verify
> if (!(Get-NetFirewallRule -Name "OpenSSH-Server-In-TCP" -ErrorAction SilentlyContinue | Select-Object Name, Enabled)) {
Write-Output "Firewall Rule 'OpenSSH-Server-In-TCP' does not exist, creating it..."
New-NetFirewallRule -Name 'OpenSSH-Server-In-TCP' -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22
} else {
Write-Output "Firewall rule 'OpenSSH-Server-In-TCP' has been created and exists."
}
verify
> Get-Service *ssh* | Where-Object {$_.Status -eq "Running"}
Status Name DisplayName
------ ---- -----------
Running sshd OpenSSH SSH Server
connect via ssh
> ssh domain\username@servername
# in wsl
$ ssh -o PreferredAuthentications=password -o PubkeyAuthentication=no marslo@server.sample.com
marslo@dc5-ssdfw14's password:
(c) 2018 Microsoft Corporation. All rights reserved.
Clink v1.3.47.d5796b
Copyright (c) 2012-2018 Martin Ridgers
Portions Copyright (c) 2020-2022 Christopher Antos
https://github.com/chrisant996/clink
Clink v1.5.18 is available.
- To apply the update, run 'clink update'.
- To stop checking for updates, run 'clink set clink.autoupdate false'.
- To view the release notes, visit the Releases page:
https://github.com/chrisant996/clink/releases
DOMAIN\marslo@SERVER.SAMPLE.COM C:\Users\marslo>
> ssh-keygen -t ed25519
# By default the ssh-agent service is disabled. Configure it to start automatically.
# Make sure you're running as an Administrator.
> Get-Service ssh-agent | Set-Service -StartupType Automatic
# Start the service
> Start-Service ssh-agent
# This should return a status of Running
> Get-Service ssh-agent
# Now load your key files into ssh-agent
> ssh-add $env:USERPROFILE\.ssh\id_ed25519
standard user
# Get the public key file generated previously on your client
> $authorizedKey = Get-Content -Path $env:USERPROFILE\.ssh\id_ed25519.pub
# Generate the PowerShell to be run remote that will copy the public key file generated previously on your client to the authorized_keys file on your server
> $remotePowershell = "powershell New-Item -Force -ItemType Directory -Path $env:USERPROFILE\.ssh; Add-Content -Force -Path $env:USERPROFILE\.ssh\authorized_keys -Value '$authorizedKey'"
# Connect to your server and run the PowerShell using the $remotePowerShell variable
> ssh username@domain1@contoso.com $remotePowershell
administrative user
[!NOTE] This example shows the steps for creating the administrators_authorized_keys file. This only applies to administrator accounts and must be user instead of the per user file within the user's profile location.
# get the public key file generated previously on your client
$authorizedKey = Get-Content -Path $env:USERPROFILE\.ssh\id_ed25519.pub
# generate the powershell to be run remote that will copy the public key file generated previously on your client to the authorized_keys file on your server
$remotePowershell = "powershell Add-Content -Force -Path $env:ProgramData\ssh\administrators_authorized_keys -Value '$authorizedKey';icacls.exe ""$env:ProgramData\ssh\administrators_authorized_keys"" /inheritance:r /grant ""Administrators:F"" /grant ""SYSTEM:F"""
# Connect to your server and run the PowerShell using the $remotePowerShell variable
ssh username@domain1@contoso.com $remotePowershell
> icacls.exe "C:\ProgramData\ssh\administrators_authorized_keys" /inheritance:r /grant "Administrators:F" /grant "SYSTEM:F"
troubleshooting
[!NOTE] Permissions for '/path/to/private/key' are too open
# mount
> Mount-DiskImage -ImagePath "Full path of ISO or IMG file"
# umount
> Dismount-DiskImage -DevicePath \\.\<drive letter>:
# or
> Dismount-DiskImage -ImagePath "Full path of ISO or IMG file"
or
REM mount
> PowerShell Mount-DiskImage -ImagePath """Full path of ISO or IMG file"""
REM umount
> PowerShell Dismount-DiskImage -DevicePath \\.\<drive letter>: >nul
REM or
> PowerShell Dismount-DiskImage -DevicePath \\.\<drive letter>:
REM or
> PowerShell Dismount-DiskImage -ImagePath """Full path of ISO or IMG file"""
REM i.e.:
> PowerShell Mount-DiskImage -ImagePath "G:\Win10_1903_V1_English_x64.iso"