All notes
Windows

Windows server

RDC, remote desktop connection

Enable RDC

howtogeek: turn on remote desktop in windows.

Search for “Remote Access” in the Start Menu or Start Screen.

Or, right click on "Computer", then "Properties" - "Remote Settings" - "Remote".

Problem: The credentials that were used to connect are incorrect.

First of all, make sure any RDC version is allowed. In the System Properties dialog box, under Remote Desktop, click either Allow connections from computers running any version of Remote Desktop or Allow connections only from computers running Remote Desktop with Network Level Authentication, and then click OK.

As for my problem, I found cause by manipulating on mmc (Microsoft Management Console), adding Snap-in of Local Users and Groups on local computer. It turns out that the credential failure is because I wanted to change the username to wheel but instead I only changed the display name.

See for reference: http://windows.microsoft.com/en-US/windows7/Why-can-t-I-connect-using-Remote-Desktop-Connection.

How To Disable Credentials Prompt Of Remote Desktop 6.0

http://www.boredsysadmin.com/2008/06/how-to-disable-credentials-prompt-of.html.

Below is the content section of the default.rdp file with enablecredsspsupport:i:0 option included.

redirectposdevices:i:0 
authentication level:i:0 
enablecredsspsupport:i:0 
prompt for credentials:i:0 
negotiate security layer:i:1

Shortcuts

== Window related ==

ALT+SPACE: Displays the main window's System menu
	(from the System menu, you can restore, move, resize, minimize, maximize, or close the window)
ALT+- (ALT+hyphen): Displays the Multiple Document Interface (MDI) child window's System menu
	(from the MDI child window's System menu, you can restore, move, resize, minimize, maximize, or close the child window)

Windows + up: maximize window
Windows + down: restore window / minimize window

Windows Logo+M: Minimize all
SHIFT+Windows Logo+M: Undo minimize all

ALT+F4: Closes the current window
CTRL+F4: Closes the current Multiple Document Interface (MDI) window

== Menubar ==

ALT+underlined letter in menu: Opens the menu
F10: Activates menu bar options

== Explorer = 

Alt+D: go to (edit) path.

== Other ==

ALT+double click: Displays properties

CTRL+SHIFT+ESC: Opens Windows Task Manager
Windows Logo+E: Windows Explorer
Windows Logo+F: Find files or folders
Windows Logo+D: Displays the desktop

TAB: Move to the next control in the dialog box
SHIFT+TAB: Move to the previous control in the dialog box

Windows command invoker for configure tools

Commands

appwiz.cpl

Fast way to open: "Control panel: Programs and Features".

dism

Enable and Disable Hyper-v. Superuser.


dism.exe /Online /Disable-Feature:Microsoft-Hyper-V
dism.exe /Online /Enable-Feature:Microsoft-Hyper-V /All

ipconfig


:: 清除dnscache.
ipconfig /flushdns
ipconfig /displaydns

:: windows dhcp renew command line
:: https://kb.wisc.edu/page.php?id=562
ipconfig /all
ipconfig /release
ipconfig /renew

gpedit.msc

Group Policy Editor.

net

spooler

Forcefully clear the Print Queue in Windows:


net stop spooler
del %systemroot%\System32\spool\printers\* /Q /F /S
net start spooler

net use


net use z: \\server\share

:: https://www.lifewire.com/net-user-command-2618097

net use * "\\server\my media" /persistent:no
:: In this example, I used the net use command to connect to the my media shared folder on a computer named server. The my media folder will be mapped to my highest free drive letter [*], which for me happens to be y:, but I don't want to continue mapping this drive every time I log on to my computer [/persistent:no].

net use e: \\usrsvr002\smithmark Ue345Ii /user:pdc01\msmith2 /savecred /p:yes
:: Here's a slightly more complicated example that you might see in a business setting.
:: In this net use example, I want to map my e: drive to the smithmark shared folder on usrsvr002. I want to connect as another user account I have [/user] by the name of msmith2 that's stored on the pdc01 domain with a password of Ue345Ii. I don't want to map this drive manually every time I start my computer [/p:yes] nor do I want to enter my username and password each time [/savecred].

net use p: /delete
:: I suppose an appropriate final example of net use would be the removal [/delete] of a currently mapped drive, in this case p:.

net use * \\IP\admin$ /user:IP\administrator

net user

http://technet.microsoft.com/en-us/library/cc771865.aspx.

Add, delete user:


:: Ask for help.
net user /?

net user [<UserName> {<Password> | *} [<Options>]] [/domain]
net user [<UserName> {<Password> | *} /add [<Options>] [/domain]]
net user [<UserName> [/delete] [/domain]]

netsh

SO: port forwarding.


:: Add port forwarding:
:: Direct connections from 192.168.1.111:4422 to 192.168.0.33:80
netsh interface portproxy add v4tov4 listenport=4422 listenaddress=192.168.1.111 connectport=80 connectaddress=192.168.0.33

:: To remove forwarding:
netsh interface portproxy delete v4tov4 listenport=4422 listenaddress=192.168.1.111

pkgmgr

technet.


pkgmgr /iu:"TelnetClient"

runas


runas /user:Administrator Example1Server.exe

sc

SO.


REM You must have quotation marks around the actual exe path, and a space after the binPath=.
sc.exe create <new_service_name> binPath= "<path_to_the_service_executable>"

Note that it will not work for just any executable: the executable must be a Windows Service (i.e. implement ServiceMain).

schtasks

microsoftTechnet: schtasks.


schtasks [/query] [/fo {TABLE | LIST | CSV}] [/nh] [/v] [/s computer [/u [domain\]user /p password]]

schtasks /fo CSV

REM --------------------

schtasks /create /tn TaskName /tr TaskRun /sc schedule [/mo modifier] [/d day] [/m month[,month...] [/i IdleTime] [/st StartTime] [/sd StartDate] [/ed EndDate] [/s computer [/u [domain\]user /p password]] [/ru {[Domain\]User | "System"} [/rp Password]] /?

/sc   schedule   : Specifies the schedule type. Valid values are MINUTE, HOURLY, DAILY, WEEKLY, MONTHLY, ONCE, ONSTART, ONLOGON, ONIDLE. 

REM It schedules a security script, Sec.vbs, to run every 20 minutes. Because the command does not include a starting date or time, the task starts 20 minutes after the command completes, and runs every 20 minutes thereafter whenever the system is running.
schtasks /create /sc minute /mo 20 /tn "Security Script" /tr \\central\data\scripts\sec.vbs

REM scheduled shutdown
schtasks /Create /SC ONCE /TN taskname /TR "shutdown /s" /ST hh:ss

REM --------------------

schtasks /change /tn TaskName [/s computer [/u [domain\]user /p password]] [/tr TaskRun] [/ru [Domain\]User | "System"] [/rp Password]

schtasks /run /tn TaskName [/s computer [/u [domain\]user /p password]] /? 

REM SchTasks.exe ends only the instances of a program started by a scheduled task. To stop other processes, use TaskKill.
schtasks /end /tn TaskName [/s computer [/u [domain\]user /p password]] /?

schtasks /delete /tn {TaskName | *} [/f] [/s computer [/u [domain\]user /p password]] [/?]

services.msc

sophos.com. Opening the Windows Services list.

shutdown

microsoftTechnet: shutdown.


shutdown [{-l|-s|-r|-a}] [-f] [-m [\\ComputerName]] [-t xx] [-c "message"] [-d[u][p]:xx:yy]

-l : Logs off the current user, this is also the defualt. -m ComputerName takes precedence.
-s : Shuts down the local computer.
-r : Reboots after shutdown.
-a : Aborts shutdown. Ignores other parameters, except -l and ComputerName. You can only use -a during the time-out period.

-m [ \\ ComputerName ] : Specifies the computer that you want to shut down.
-f : Forces running applications to close.

-t xx : Sets the timer for system shutdown in xx seconds. The default is 20 seconds.
-c " message "   : Specifies a message to be displayed in the Message area of the System Shutdown window. You can use a maximum of 127 characters. You must enclose the message in quotation marks.

-d [ u ][ p ] : xx : yy   : Lists the reason code for the shutdown. The following table lists the different values.
    u Indicates a user code.
    p Indicates a planned shutdown code.
    xx Specifies the major reason code (0-255).
    yy Specifies the minor reason code (0-65536).

To shut down \\MyServer in 60 seconds, force running applications to close, restart the computer after shutdown, indicate a user code, indicate that the shutdown is planned, log major reason code 125, and log minor reason code 1, type: shutdown -r -f -m \\MyServer -t 60 -d up:125:1

taskkil

microsoftTechnet: taskkill.

taskkill /pid 1234 /F

/u   Domain \ User
/p   Password
/fi   FilterName
/pid   ProcessID
/im   ImageName Specifies the image name of the process to be terminated. Use the wildcard (*) to specify all image names.

/f   : Specifies that process(es) be forcefully terminated. This parameter is ignored for remote processes; all remote processes are forcefully terminated.
/t   : Specifies to terminate all child processes along with the parent process, commonly known as a tree kill.

taskkill /pid 1230 /pid 1241 /pid 1253
taskkill /f /fi "USERNAME eq NT AUTHORITY\SYSTEM" /im notepad.exe
taskkill /s srvmain /f /im notepad.exe
taskkill /s srvmain /u maindom\hiropln /p [email protected] /fi "IMAGENAME eq note*" /im *
taskkill /s srvmain /u maindom\hiropln /fi "USERNAME ne NT*" /im *
taskkill /f /fi "PID ge 1000" /im *

msiexec

technet: msiexec.


:: Uninstall program:
msiexec /x {Package | ProductCode}

/a: Applies the administrative installation option.
/i: Installs or configures a product.
/x: Uninstall.
ProductCode: Specifies the globally unique identifier (GUID) of the Windows Installer package.

mstsc

mstsc: MS terminal service client.

/v: computername — specifies the name of the computer to connect to.
/f — starts the connection in a full screen.
/w:width — specifies the width of the remote desktop screen.
/h:height — specifies the height of the remote desktop screen.

mstsc /v: Kaltec /w:640 /h:480

Directories

AppData\Roaming

Windows uses the Roaming folder for application specific data, such as custom dictionaries, which are machine independent and should roam with the user profile. The AppData\Roaming folder in Windows Vista is the same as the Documents and Settings\username\Application Data folder in Windows XP.

Windows FAQ

Sougou Input method

How to disable Ctrl+L shortcut?

  1. Right click on Sougou input method bar and get the settings GUI.
  2. Click "输入法管理".
  3. Find "搜狗拼音快捷键", change it to other combination.

Add multiple IP's

blog.163.com: Windows下添加多个IP地址.

  1. 选择“本地网络”, 右键“属性”
  2. 选择“INTERNET PROTOCOL (TCP/IP)”然后点击“属性”。
  3. 面板打开后,这时点击右下方的“高级”
  4. 在IP地址下方点击“添加” 上方填上你的IP。

Adhoc wireless on win10

UPDATE 3: I switched back to native Ad-hoc support, and it works find now. Something to note: 1. Avira Antivirus is disabled since some says it may cause trouble to Adhoc. 2. When my cell phone goes out of scope, the WiFi adhoc will be automatically turned off after it finds no clients is connected. Just re-enable it.

UPDATE 2: Although windows 10 has native support for Ad-Hoc, but the connection is still un-stable. See howtogeek for other tips on how to reverse tethering. wcfNote: I tried the "Connectify Hotspot" and it works very well, except that it still need you to operate on LAN interface to share its internet.

UPDATE: now windows 10 has native support for Ad-Hoc. But after enabling the Ad-Hoc, you still need to operate on LAN interface to share its internet to the newly created connection.

tomsharedware shows that the Ad-Hoc network has "192.168.137.0".

WCFNote: warning: only the windows' own driver allows Ad-Hoc! The driver I downloaded from TP-Link has not Ad-Hoc at all!

转回Windows自带驱动(应该是:Realtek RTL8188EU 无线 LAN 802.11n USB 2.0 网络适配器)。如果遇到问题请看:160.com: “系统找不到指定文件” 的解决方法。.

我的解决方案是,下载windows修复程序,运行修复以后重启,再更新驱动就可以了。MicroSoftSupport: kb.

要更新到windows驱动的步骤:选择“浏览计算机以查找驱动程序软件”(这一步是为了手动,所以不要选择自动那一个) - “从计算机的设备驱动程序列表选取”,选择最下面那个——也是默认安装的那个。

redmondpie.com: create ad-hoc wifi hotspot in Windows 10.

  1. Windows + X keys to open the power user settings panel, and launch Command Prompt (Admin) to get started.
  2. Simply replace “adhocname” with a name of your choice, and to change the password, replace “password” with one of your choice: netsh wlan set hostednetwork mode=allow ssid=adhocname key=password.
  3. Start the network: netsh wlan start hostednetwork.
  4. Open the “View network connections” window, which can be found easily by searching for it using search bar in the Taskbar.
  5. Right-click your Ethernet connection and select Properties and switch to the Sharing tab. Check the “Allow other network users to connect through this computer’s Internet connection” option, and choose the newly created WiFi connection from the drop down list located under “Home networking connection”.

baiduJingyan.


REM First stop the old:
netsh wlan stop hostednetwork
netsh wlan set hostednetwork mode=disallow

netsh wlan set hostednetwork mode=allow ssid=wifi key=12345678
netsh wlan start hostednetwork

MSDN: netsh.

netsh wlan start hostednetwork
    Start the wireless Hosted Network.

netsh wlan stop hostednetwork
    Stop the wireless Hosted Network.

netsh wlan set hostednetwork [mode=]allow|disallow
    Enable or disable the wireless Hosted Network.

netsh wlan set hostednetwork [ssid=] [key=] [keyUsage=]persistent|temporary
    Configure the wireless Hosted Network settings.

netsh wlan refresh hostednetwork [data=] key
    Refresh the wireless Hosted Network key.

netsh wlan show hostednetwork [[setting=]security]
    Display wireless Hosted Network information.

netsh wlan show settings
    Display wireless LAN global settings.

Default printer changes on every restart of Windows 2008

  1. Click Start, type "gpedit.msc" in the Start Search box, and then press ENTER.
  2. Under "Local Policy", find through: Local policies | Computer config | admin templates | windows components | terminal services | terminal server | printer redirection. Enalbe the following:
    • do not set default client printer to be default printer in a session
    • redirect only the default client printer

If you leave the group policy setting “Do not set default client printer to be default printer in a session” as not Not Configured, in both Local Group Policy and domain Group Policy level, the server will automatically set the default printer on the client to be the default one in the remote session.

If you want to change this behavior, please change the policy setting to be Enable. In that situation, the default printer will be the local printer configured on the server side.

Policy path: 
    Windows Components\Remote Desktop Services\Remote Desktop Session Host\Printer Redirection
Scope: Machine

Registry settings: 
    HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services\fForceClientLptDef

Disable UAC

  1. Goto "Control Panel".
  2. Search for "uac".
  3. Move the slider to the "Never notify".

Host file

C:\Windows\System32\Drivers\etc\hosts.


0.0.0.0    www.facebook.com

Office save as PDF

zhidao: office 2010 word 每次打开和关闭都提示宏错误.

第1种方法: 如果你手头有Office 2010的安装程序或电脑有安装文档的话 在控制面板中打开程序和功能,选择Office 2010右键点击更改,再打开Office 2010安装程序-选择"添加或删除功能"重新添加"office 共享功能"中的"visual Basic for Applications"组件 安装完成后,再次启动Word,即搞定

第2中方法: Word选项——加载项——管理【com加载项】,转到——把几个勾勾都取消掉——确定,即可。Win7中注意要以管理员身份进行,因为这些写入了注册表。

Page file, PAGEFILE.SYS

Optimizing Your Paging File. RAM, virtual memory, pagefile, and memory management in Windows. Windows NT uses a paging file for virtual memory called PAGEFILE.SYS.

Virtual memory

Open Start up folder

Type "shell:startup" in start menu, the folder will open in explorer.

For example: "C:\Users\username\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup folder". You may put BAT files here.

Print Word with high quality images

bioPDF: PDF image quality. In Bullzip settings, uncheck the "Compress images". Then print to Bullzip.

MicroSoft answers. Try using the free PrimoPDF converter to convert (print) you document to a pdf file. In it's Prepress mode, the default setting is for "No Downsampling".

MSDN. If they insert an eps file into word and send it to us in a docx, we rename the docx to .zip and look in the images folder. What we find is that the images have been converted to well formed .emf files. The .emf files can be inserted into word 2010 and converted to a pdf with perfect quality.

Microsoft Anwsers. For Office newer than Version 2010, take a look in File tab - Options command - Advanced option - Image Size and Quality section. Look at the options to "Do Not Compress images in file" and "Set default target output to: ".

Remove drivers

SO: completely remove a device driver in windows.

Method 1

An easier (and arguably less error-prone) method to find the oem.inf file name would be to go into Device Manager, right-click the device, go to Properties, then Details tab, and select INF Name from the dropdown list.

Method 2

Another option (the Microsoft way, without doing random unknown deletings in the registry) is to start CMD as "run as admin" and then list all installed drivers in the Windows 7 driver store via:


pnputil -e > C:\driverexport.txt

REM If you have found now the driver you need to remove use the following comand:
pnputil.exe -d OemNUMBER.inf

replace NUMBER with your number from your example. You might try to use -F to force the uninstallation. Once a reboot is done the driver should be gone. This might be also usefull to delete old drivers and get some HD space back.

Scheduled tasks

iLoveFreeSoftware.

  1. Right click on This PC, and click on Manage to launch the Computer Management console. Once there, head over to the left pane, and click on Task Scheduler under System Tools.
  2. The center pane will now show up a summary of scheduled tasks, along with information such as task status, active tasks etc. Move to the right Actions pane, and click on Create Basic Task to start the task scheduler wizard.
  3. The Basic Task Wizard provides a simple stepwise approach for creating a simple scheduled task. At the first step of the wizard, provide a name and description to the task, and hit Next. On the next screen, you can configure the starting time for the task, as well as specify whether the task is a recurring one or not.
  4. Over the next two steps of the wizard, you can specify the exact time and date for automatically running the task, and of course, select the program that you want to run automatically at the designated time.

What is UNC

Universal Naming Convention (UNC).

In Windows operating systems, the UNC name format is:

\\servername\sharename\path\filename

Install .Net 3.5 on windows 2012

Solution: update windows 2012 to latest and install again.

The bug is caused by that, installation of .Net 3.5 requires sxs installation media (thus the warning), while on Azure we don't have this.

Nginx as a service

myhack58.

  1. Download windows service wrapper.
  2. Rename the exe as nginxWrapper.exe. Add nginxWrapper.xml as follows.
  3. nginxWrapper.exe install/uninstall/start/stop
  4. Check whether there is already a nginx service.

NginxWrapper.xml:


<?xml version="1.0" encoding="UTF-8" ?>
<service>
  <id>nginx</id>
  <name>nginx</name>
  <description>nginx</description>
  <executable>nginx.exe</executable>
  <logmode>roll</logmode>
  <arguments></arguments>
  <depend></depend>
</service>

Excel

Shortcuts

Windows

F2: Edit cell.
Ctrl+Shift+HOME: Select all text in a cell.   

MacOS

Apple+Shift+Left: Select all text in a cell.   

Visual studio

SN for 2013 ultimate: BWG7X-J98B3-W34RT-33B3R-JVYW9

Softwares