Wednesday, August 24, 2011

Run separate explorer window as Admin

This can be accomplished in 2 ways:

1. best, most reliable method, uses undocumented /separate switch, launches explorer in a separate process

runas /u:domain\username "explorer.exe /separate"

2. Per-user setting, but can be set in default user profile so that it works for all users

in an explorer window: Folder Options>View tab>Advanced Settings>Launch folder windows in a separate process.
If this setting is enabled, then the command below will work (without the /separate switch)

runas /u:domain\username explorer.exe

Wednesday, August 17, 2011

Change Windows 7 critical battery level

POWERCFG -SETDCVALUEINDEX a1841308-3541-4fab-bc81-f71556f20b4a e73a048d-bf27-4f12-9731-8b2076e8891f 9a66d8d7-4ff7-4ef9-b5a2-5a326ca2a469 1

POWERCFG -SETACVALUEINDEX a1841308-3541-4fab-bc81-f71556f20b4a e73a048d-bf27-4f12-9731-8b2076e8891f 9a66d8d7-4ff7-4ef9-b5a2-5a326ca2a469 1

Power Scheme GUID: a1841308-3541-4fab-bc81-f71556f20b4a (Power saver)
Subgroup GUID: e73a048d-bf27-4f12-9731-8b2076e8891f (Battery)
Power Setting GUID: 9a66d8d7-4ff7-4ef9-b5a2-5a326ca2a469 (Critical battery level)
Current DC Power Setting Index: 1 (1%)

Google Chrome prevents Windows 7 from sleep

see http://www.google.com/support/forum/p/Chrome/thread?tid=3b1d41b0663a4d40&hl=en

in a command window:
powercfg -requestsoverride PROCESS chrome.exe awaymode display system

to remove the override:
powercfg -requestsoverride PROCESS chrome.exe

source:
http://download.microsoft.com/download/7/E/7/7E7662CF-CBEA-470B-A97E-CE7CE0D98DC2/AvailabilityRequests.docx.

more far-reaching fix if you have a 'Pro' version of windows 7 - editing local group policy:
start>Run>gpedit.msc
Computer Configuration>Administrative Templates>System>Power Management>Sleep Settings>

Set
Allow Applications to Prevent Automatic Sleep (On Battery)
and
Allow Applications to Prevent Automatic Sleep (Plugged In)

to disabled.

but this applies to ALL applications, not just chrome.

Sunday, January 2, 2011

File System links in Windows Vista/7

MKLINK.exe

no argument: FILE symbolic link (like a shortcut but not stored as a .lnk file)
/D: DIRECTORY symbolic link (like a shortcut but not stored as a .lnk file)
/H: FILE junction (hard link) (think of data deduplication; only one physical FILE but multiple logical locations)
/J: DIRECTORY junction (hard link) (think of data deduplication; only one physical DIRECTORY but multiple logical locations)

I've only ever used /J for directory links.

Directory Linker, a nifty GUI for creating symbolic links: http://dirlinker.codeplex.com/

NOTE: The first two methods use 'symbolic links' which may fail when used across network drive mappings. ("The symbolic link cannot be followed because its type is disabled") In this case, the fsutil utility may need to be used to enable the various symbolic link 'types': R2R, L2L, L2R, R2L.

fsutil behavior set SymlinkEvaluation L2L:1 R2R:1 L2R:1 R2L:1

"fsutil.exe" can be made to show what arguments it takes by simply running:

fsutil behavior set /?
The symbolic-link resolution behavior is set on the machine that accesses a given link, not the machine that hosts it.

The behavior codes for "fsutil.exe", namely "L2L", "L2R", "R2L", and "R2R", mean the following:

"L" stands for "Local", and "R" for "Remote" (who would've thunk?)
The FIRST "L" or "R" - before the "2" - refers to the location of the link itself (as opposed to its target) relative to the machine ACCESSING the link.
The SECOND "L" or "R" - after the "2" - refers to the location of the link's target relative to the machine where the LINK itself is located.
Thus, for instance, enabling "R2L" means that you can access links located on a remote machine that point to targets on that same remote machine.

More Info:
stackoverflow.com