>wmic computersystem get manufactureranufacturerSupermicro
serial number
>wmic bios get serialnumberSerialNumberSxxxxxxxxxxxxx2
product name
>wmic computersystem get model,name,manufacturer,systemtype
uuid
>wmic csproduct get uuidUUID00000000-0000-0000-0000-0xxxxxxxxxxx
system slot
>wmic systemslot get slotdesignation,currentusage,description,statusCurrentUsage Description SlotDesignation Status4 System Slot RSC-R1UW-2E16 SLOT1 PCI-E X16 OK3 System Slot RSC-R1UW-2E16 SLOT2 PCI-E X16 OK3 System Slot RSC-R1UW-E8R SLOT1 PCI-E X8 OK4 System Slot AOC-URN2-i4GXS SLOT1 PCI-E 3.0 X8 OK
cpu
>wmic cpu get DeviceID,NumberOfCores,NumberOfLogicalProcessors,Manufacturer,Name,ProcessorIdDeviceID 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:ListNumberOfCores=8NumberOfLogicalProcessors=16SocketDesignation=CPU1NumberOfCores=8NumberOfLogicalProcessors=16SocketDesignation=CPU2REM or>echo %NUMBER_OF_PROCESSORS%32
or
>Get-WmiObject –classWin32_processor| ft NumberOfCores,NumberOfLogicalProcessorsNumberOfCores NumberOfLogicalProcessors--------------------------------------816
os
>wmic os get Caption,CodeSet,Manufacturer,OSArchitecture,SerialNumberCaption CodeSet Manufacturer OSArchitecture SerialNumbericrosoft 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
>diskpartDISKPART> 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 BootDISKPART> list diskDisk ### Status Size Free Dyn Gpt-------- ------------- ------- ------- --- ---Disk 0 Online 223 GB 0 BDisk 1 Online 7151 GB 0 B * *DISKPART> select disk 0Disk 0 is now the selected disk.DISKPART> detail diskAVAGO SMC3108 SCSI Disk DeviceDisk ID: 000B6070Type : RAIDStatus : OnlinePath : 1Target : 0LUN ID : 0Location Path : PCIROOT(0)#PCI(0200)#PCI(0000)#RAID(P01T00L00)Current Read-only State : NoRead-only : NoBoot Disk : YesPagefile Disk : YesHibernation File Disk : NoCrashdump Disk : YesClustered 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 BootDISKPART> select disk 1Disk 1 is now the selected disk.DISKPART> detail diskAVAGO SMC3108 SCSI Disk DeviceDisk ID: {057A21CC-17C6-45E2-893C-D68B128CAD35}Type : RAIDStatus : OnlinePath : 1Target : 1LUN ID : 0Location Path : PCIROOT(0)#PCI(0200)#PCI(0000)#RAID(P01T01L00)Current Read-only State : NoRead-only : NoBoot Disk : NoPagefile Disk : NoHibernation File Disk : NoCrashdump Disk : NoClustered Disk : No Volume ### Ltr Label Fs Type Size Status Info ---------- --- ----------- ----- ---------- ------- --------- -------- Volume 0 E New Volume NTFS Simple 7151 GB Healthy
mac address
>getmacPhysical Address Transport Name=================== ==========================================================AC-xx-xx-xx-xx-xx Media disconnectedN/A Hardware not present0C-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,versionName VersionALM-Platform Loader 11.5x 11.52.444.0icrosoft Lync Web App Plug-in 15.8.8308.577Google App Engine 1.8.6.0icrosoft Office Professional Plus 2010 14.0.6029.1000icrosoft Office OneNote MUI (English) 2010 14.0.6029.1000...
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
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