mswin


Windows GUIDE

General tips and tricks for when Windows is throwing a tantrum.

HOW TO ADD TAKE OWNERSHIP OPTION TO CONTEXT MENU


Open Notepad (Start Menu > notepad) and type the below code into it.

Save the file with a .reg extension and then double click it to run the command.


[HKEY_CLASSES_ROOT*\shell\runas] @="Take ownership" "HasLUAShield"="" "NoWorkingDirectory"=""


[HKEY_CLASSES_ROOT*\shell\runas\command] @="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant administrators:F" "IsolatedCommand"="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant administrators:F"


[HKEY_CLASSES_ROOT\Directory\shell\runas] @="Take ownership" "HasLUAShield"="" "NoWorkingDirectory"=""


[HKEY_CLASSES_ROOT\Directory\shell\runas\command] @="cmd.exe /c takeown /f \"%1\" /r /d y && icacls \"%1\" /grant administrators:F /t" "IsolatedCommand"="cmd.exe /c takeown /f \"%1\" /r /d y && icacls \"%1\" /grant administrators:F /t"

HOW to add a driver to a boot image


Open command prompt (Start Menu > cmd or C:\windows\system32\cmd.exe)

Type the following commands after renaming the directory paths and install.wim file to the ones on your system.


dism /mount-wim /wimfile:C:\temp\test\sources\install.wim /index:1

/mountdir:C:\temp\test\random

dism /image:C:\temp\test\random /add-driver /driver:C:\temp\test\sources\drives /recurse

dism /unmount-wim /mountdir:c:\temp\test\random /commit

AUTO START A SERVICE ON BOOT


Open file explorer and navigate to or create C:\autoboot Open notepad and type a command, for example: cd C:\inetpub\wwwroot\server node server.js or cd c:\inetpub\wwwroot\KiwiIRC kiwi start then save the file as filename.bat then open a blank notepad and type


Set oShell = CreateObject ("Wscript.Shell")

Dim strArgs

strArgs = "cmd /c filename.bat"

oShell.Run strArgs, 0, false


Then save the file as filename.vbs close notepad and navigate to C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup create a shortcut to C:\autoboot\filename.vbs

HOW TO ADD SHOW DESKTOP BACK TO WINDOWS 10


In Windows 10 the show desktop icon was replaced by a thin invisible line on the far right of the task bar.

To create a Windows 7 style "show desktop icon" instead follow the steps outlined below:


1.) Open up notepad (Start Menu > notepad)

Enter the code below and save the file as "Show Desktop.scf"


[Shell]

Command=2

IconFile=explorer.exe,3

[Taskbar]

Command=ToggleDesktop

AUTO LOGIN ON BOOT up


This function is built into Windows and can be turned on by editing the registry.

Open Regedit (Start Menu > Regedit)


Navigate to: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon

Add or edit the following strings.


DefaultUserName REG_SZ Username

DefaultPassword REG_SZ Password

AutoAdminLogin REG_SZ 1

DefaultUserName REG_SZ Username

DefaultPassword REG_SZ Password

*add (DefaultDomain REG_SZ Domain) if the pc is on a domain

AUTO RUN A COMMAND ON BOOT Up


You need to create 3 files to accomplish this.

*open notepad.exe enter code and "save as" .bat or .vbs to create files


1.) a .bat file containing the command.

2.) a .vbs file to auto run the .bat file

3.) a shortcut to the .vbs file located in the windows startup folder.


DOS Batch File Examples: (filename.bat)


Example 1:

cd C:\inetpub\wwwroot\node\server

node server.js


Example 2:

cd c:\inetpub\wwwroot\KiwiIRC

kiwi start


Virtual Basic Script Example (filename.vbs)


Set oShell = CreateObject ("Wscript.Shell")

Dim strArgs

strArgs = "cmd /c nodestart.bat"

oShell.Run strArgs, 0, false


*replace "nodestart" with the name of your batch file.


Shortcut Directions (Shortcut file)


Right click your filename.vbs file and select "Create Shortcut".

Open a new instance of Windows Explorer (Start Menu > Explorer)

Navigate to: C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup

Click and drag your filename.vbs - shortcut file into the startup folder.

HOW TO WRITE A SERVICE RESTART SCRIPT


Run services.msc and select the service you want to restart.

Right-click properties and take note of the service name.

Open notepad and type the following:


@echo off

NET STOP servicename

timeout /t 5 /nobreak > NUL

NET START servicename

timeout /t 2 /nobreak > NUL

save the file as a .bat and double click it to run.



CORRECT an UNRECOGNIZED COMMAND

For example if (ipconfig) is no longer recognized, check that the default "long" command (windows\system32\ipconfig /all) still works.

To fix this right click "My Computer" & select "Properties." > Click "Advanced" tab. >Click "Environment Variables" button. Then in the "System variables" box, scroll down to "PATH" and highlight it. Click the "Edit" button and in the "Variable value:" box, add this string to the very beginning of the text "C:\WINDOWS\system32;" without my quotation marks. Make sure you include the semicolon. Then click OK three times.

That should of have done it to test open cmd, right-click and select "run as administrator", Type cd C:\ hit enter, Type ipconfig, hit enter.

HOW TO CHANGE the WINDOWS 10 PRODUCT KEY


Open command prompt (cmd) and run the following replacing the inpkey with the new product key.


cscript "c:\Program Files (x86)\Microsoft Office\Office15\ospp.vbs" /inpkey:YT000-YM000-JH000-YW000-Q9000

CLEARing the PRINTER SPOOLER


Navigate to the spooler folder where print jobs are cached


\\computername\c$\Windows\System32\spool\PRINTERS

and delete all items.

HOW To MANUALLY DISABLE BITLOCKER


At the Bitlocker Key required screen


Disable Bitlocker on C: by accessing CMD via the loop:

Advanced Options > Troubleshooting > Advanced Options > Command Prompt.


Once in CMD:

run the following commands where the string (68660-etc) is the Bitlocker Key


Manage-bde -status C: and Manage-bde -unlock c: -rp 686600-000000-000000-000000-000000-000000-000000-000000 and Manage-bde -protectors -disable c:

HOW TO FIND the SERVICE TAG VIA CMD


Run CMD: (C:/windows/system32/cmd.exe)

Type: wmic bios get serialnumber


If you're on a LAN and access the PC remotely.

Type: nsclookup "Name of PC" to find it's IP4

Type: wmic /node:10.0.0.0 /user:admin /password:creds bios get serialnumber

HOW TO REMOVE DOMAIN POLICIES


Backup your registry.


Delete the HKLM\Software\Policies\Microsoft Key (looks like a folder).

Delete the HKCU\Software\Policies\Microsoft Key.

Delete the HKCU\Software\Microsoft\Windows\CurrentVersion\Group Policy Objects Key.

Delete the HKCU\Software\Microsoft\Windows\CurrentVersion\Policiess Key.

FORCE READ PRIVILIAGES ON a FOLDER


Navigate to the containing directory of the folder you want to edit in CMD. cd C:\inetpub\wwwroot\ then type command: icacls trickyfolder /grant:r "Administrators":(OI)(CI)M


Open Windows explorer (Start Menu > explorer).

Right-click "My Computer" & select "Properties."


Click "Advanced/Advanced System Settings" tab.

Click "Environment Variables" button.

In the "System variables" box, scroll down to "PATH" and highlight it. Click the "Edit" button. In the "Variable value:" box, add to the very beginning of the text "C:\WINDOWS\system32;" without my quotation marks. (replace system32 with system depending on the location of icacls) Make sure you include the semicolon.

Click OK three times.