To show GUI dialog with Windows build/version information type:
<Win+R> winver <Enter> <Win+Break>
or run:
cmd> winver
cmd has built-in command ver.
For Win 2000 and upper check registry key:
cmd> reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v CurrentVersion
To check 32/64-bit OS use PROCESSOR_ARCHITECTURE env var (it has such values: x86, AMD64, IA64).
Full info about Windows edition available from this .vbs:
cmd> slmgr -dli
To find updates and drivers visit (подлинность Windows not checked):
You can search driver by keywords from Device Manager like:
VEN_10DE DEV_0247 VID_22B8 PID_2A62
After obtaining .cab file for driver unpack files:
cmd> expand FILE.cab -F:* c:\tmp\dir
and use that directory in "Update driver" dialog.
Also you can find updates on:
Updates that reset pirate copy of Windows: КВ971033.
List of installed updates with full information:
cmd> wmic qfe power# get-hotfix
List only hotfix id:
cmd> wmic qfe get hotfixid power# get-hotfix -id KB...,KB...
Run check with (utility is available starting from Windows 2000):
cmd> sfc /Scannow
Look to c:/Windows/Logs/CBS/CBS.log for errors and warnings.
To repair run:
dism /Online /Cleanup-image /Scanhealth dism /Online /Cleanup-Image /RestoreHealth
Alternative cmdlet in PowerShell:
Repair-WindowsImage -Online -RestoreHealth Repair-WindowsImage -Online -CheckHealth Repair-WindowsImage -Online -ScanHealth
If Windows Update is broken you can provide path:
dism /Online /Cleanup-Image /RestoreHealth /Source:C:\RepairSource\Windows /LimitAccess
See:
If you only damage boot sector of master or system partition boot from Windows XP installation CD, enter to recovery console and run:
cmd> fixboot cmd> fixmbr
See:
Show current key details:
: basic slmgr.vbs /dli : detailed slmgr.vbs /dlv
Install an activation key:
slmgr.vbs /ipk YGR45-THIS9-WONT5–0WORK-D7667
Activate Windows:
slmgr.vbs /ato
Reset the evaluation period/licensing status and activation state of the machine:
slmgr.vbs -rearm
Check exparation date:
slmgr.vbs /xpr
See:
Replace %WINDIR%/system32/winlogon.exe with valid in Safe Mode and run Windows Product Key Update Tool.
Edit %windir%/system32/Drivers/etc/hosts. Under Windows 7/8/10 you need to run editor with "Run as administrator".
By default, you cannot authenticate and share files to and from Mac OS X or Linux Samba due to a well known authentication method turned off by default. To enable this,
Goto Start->Run and open gpedit.msc or secpol.msc
Select Continue on the User Account Control prompt. This will launch the Group Policy Object Editor for the Local Computer Policy.
In the Group Policy Object Editor, expand:
-> Computer Configuration -> Windows Settings -> Security Settings -> Local Policies -> Security Options
Open the "Network security: LAN Manager authentication level" policy and change the Security Setting to:
Send LM & NTLM - use NTLMv2 session security if negotiated
Since Windows Vista Home Edition does not feature the Group Policy Editor, you may do the following to enable this feature:
Goto Start->Run-> and type regedit.
Select Continue on the User Account Control prompt.
Navigate to HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlLsa
Create the following DWORD value (if it doesn't exist): LmCompatibilityLevel
And set its value to: 1
msconfig: | System Configuration Utility, you can disable services registered at boot. |
---|---|
regedit: | Registry Editor. |
services.msc: | Service management. |
compmgmt.msc: | Computer management. |
devmgmt.msc: | Device manager. |
diskmgmt.msc: | Disk management. |
msinfo32: | System Information. |
perfmon.msc: | Performance monitor. |
These scripts can be invoked via Win+R:
dfrg.msc - Disk defrag eventvwr.msc - Event viewer fsmgmt.msc - Shared folders gpedit.msc - Group policies lusrmgr.msc - Local users and groups secpol.msc - Local security settings win.ini - windows loading information(also system.ini) winver - Shows current version of windows command - Opens command prompt control fonts - Fonts Folder control printers - Printers Folder appwiz.cpl - Add & Remove Programs timedate.cpl - Date/Time Properties desk.cpl - Display Properties inetcpl.cpl - Internet Options mmsys.cpl - Sound Settings sysdm.cpl - System Properties password.cpl - Password Options main.cpl - Mouse and Keyboard Options
User Account applets:
Netplwiz.exe control /name Microsoft.UserAccounts
.cpl scripts can be run from command line as:
cmd> Rundll32 Shell32.dll,Control_RunDLL cmd> Rundll32 Shell32.dll,Control_RunDLL Mmsys.cpl,,0
260 chars. Use MAX_PATH macros from 'windows.h'.
Not allowed: * characters from 0 to 31 * < (less than) * > (greater than) * : (colon) * " (double quote) * / (forward slash) * \ (backslash) * | (vertical bar or pipe) * ? (question mark) * * (asterisk)
All 32-bit Windows XP support only 4 GiB RAM. To enable PAE (Physical Address Extension) edit c:\boot.ini, add option /pae:
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="MS Windows XP Prof" /fastdetect /pae
NX (no execute) in Windows realised in Data Execution Prevention (DEP) technology.
On 64-bit processes, DEP is enabled by default and cannot be disabled. For 32-bit Windows DEP is supported in Windows Server 2003 with SP1, Windows XP with SP2, Windows Vista, and later versions of Windows.
To enable NX on 32-bit Windows edit 'c:boot.ini', add option '/noexecute=...' (alwayson/optout/optin/alwaysoff):
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="MS Windows XP Prof" /fastdetect /noexecute=alwayson
To see current DEP status run:
cmd> wmic OS Get DataExecutionPrevention_Available cmd> wmic OS Get DataExecutionPrevention_SupportPolicy cmd> wmic OS Get DataExecutionPrevention_Drivers
To craete use 'junction.exe' from Mark Russinovich or 'linkd.exe' from Microsoft Windows 2000 Resource Kit.
'junction.exe' included with Sysinternals suite:
cmd> md c:\Program-Files cmd> junction c:\Program-Files "c:\Program Files"
http://blogs.technet.com/b/srd/archive/2010/07/28/announcing-the-upcoming-release-of-emet-v2.aspx
To disable UAC on the computer, you must be able to log on with or provide the credentials of a member of the local Administrators group.
Starting with Windows 7, UAC is disabled by following these steps:
On Windows Vista and Windows Server 2008, UAC is disabled by following these steps:
Check current association:
$ cmd /c assoc | grep -i "^\.mp3" .mp3=mp3file
Get list of all available commands:
$ cmd /c ftype ... AIMP.mp3="C:\Program Files\AIMP2\AIMP2.exe" "%1" ...
and select one on them:
$ cmd /c assoc .mp3=AIMP.mp3
Run cleanmgr.exe.
Disable hibernation:
powercfg /hibernate off
On Windows 10 use compaction (compressing Windows bloatware). It frees about 2 GiB:
Compact.exe /CompactOS:always
Clean up WinSXS directory (from admin permission):
DISM /online /Cleanup-Image /SpSuperseded DISM /online /Cleanup-Image /StartComponentCleanup /ResetBase
You can safely remove SP restore files:
%Systemroot%\$NtServicePackUninstall$
Also check such directories:
%SYSTEMDRIVE%\Program Files\Common Files %SYSTEMDRIVE%\Documents and Settings\USER\Application Data %SYSTEMDRIVE%\Documents and Settings\USER\Local Settings
List registered of task:
$ schtasks /query
Create task:
$ schtasks /create /tn %TASK_NAME% /ru %ROOT% /sc daily /st 23:00:00 /tr "rundll32.exe user32.dll,LockWorkStation"
/sc can be one of:
MINUTE HOURLY DAILY WEEKLY MONTHLY ONCE ONSTART ONLOGON ONIDLE
Delete task:
schtasks /delete /tn %TASK_NAME% /f
icacls allow option:
Permissions description:
To review current permissions:
cmd> icacls %dir% /t
Note
To get brief view of permissions use AccessEnum utility from Sysinternals.
Recursively change the owner of all matching files to the specified user:
cmd> icacls %dir% /setowner %user% /t /c
or simply:
cmd> takeown /r /f %file%
Note
Sometimes you don't have enough permssion to change permission. Run commands from administrator shell.
Recursively grand full access for everyone:
cmd> icacls %dir% /t /grant:r %user%:(f) cmd> icacls %dir% /t /grant:r *S-1-1-0:(f)
Somtimes it fail due to permission inheritance, try to strip them:
cmd> icacls %dir% /inheritance:r /t /grant:r %user%:(f)
Remove all permissons from file (first reset to inherited, then remove inherited):
cmd> icacls %FILE% /reset cmd> icacls %FILE% /inheritance:r
Read file attributes:
cmd> attrib %FILE%
Set/remove attributes (/s - recursive):
cmd> attrib +r -h %DIR% /s
List available users:
cmd> net user cmd> wmic useraccount list brief
List available groups:
cmd> net localgroup
List available users in group:
cmd> net localgroup %GROUP% cmd> net localgroup Administrators cmd> net localgroup Users
Current logged user:
cmd> whoami
Create new user by supplying password argument:
cmd> net user /ADD %USER% %PASS%
Create new user by entering password in prompt:
cmd> net user /ADD %USER% *
Pring SIDs of groups:
cmd> whoami /groups
Print current user SID:
cmd> whoami /user
Get name from SID:
cmd> PsGetsid.exe S-1-0-0
Get SID from name:
cmd> PsGetsid.exe "NT AUTHORITY\System" cmd> PsGetsid.exe "NT AUTHORITY\LocalService"
Well known users/groups:
See:
Use 'PsGetSid' utility from Sysinternals:
cmd> PsGetSid S-1-3-0 cmd> PsGetSid "\NULL SID"
cmd> systeminfo
From Win+R:
helpctr.exe -mode hcp://system/sysinfo/msinfo.xml
or by:
cmd> %SystemRoot%\pchealth\helpctr\binaries\helpctr.exe -mode hcp://system/sysinfo/msinfo.xml
cmd# control userpasswords2
Most of registry tweaks have no effect or inconsistent on Windows time scheduling.
Better way to control time sync is via Windws Task with commands (start service and force update):
%windir%\system32\sc.exe start w32time task_started %windir%\system32\w32tm.exe /resync
Replace with own disk letter:
cmd# format E: /q /fs:ntfs
See:
%SystemRoot%\system32\GroupPolicy\User\Scripts\Logoff and %SystemRoot%\system32\GroupPolicy\User\Scripts\Logon.
%SystemRoot%\System32\drivers\etc\hosts.
Path to directory defined by registry key:
bash# cat /proc/registry/HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/tcpip/Parameters/DataBasePath %SystemRoot%\System32\drivers\etc