Friday, March 5, 2010
Credibility
Would the content of the comments matter?
Great post!
by Adje
Wonderfully put
by Frank
Experienced the very same thing!
by ScreenMan
Are you kidding me?
by TheDude
Sunday, February 28, 2010
Chrome doesn’t stack or tile in Windows 7
Windows 7 has two features called
- Show windows side by side
- Show windows stacked
These can be reached by right-clicking the task-bar.
Personally, I don’t really have a need for it, but as it’s there, I decided to have a go at it.
So I opened some applications. Well, actually a few more than some: 35 to be exact. Unfair on Windows really, but it behaves remarkably well. With so many windows to tile or stack, the frames get of course very small, and they start overlapping. Which is curious, as they have not yet reached their resize limits!??!
Of course, there’s also apps that don’t resize so far down when done manually. Like Yahoo Messenger for example. As is to be expected, they don’t tile or stack well (as they refuse to get that small).
But what about Google Chrome? Manually it can be resized to any level; but when tiles or stacked, it doesn’t play ball. It refuses to budge even by 1 pixel. It simply remains sitting there…..
Now why would that be? Anyone?
Monday, February 22, 2010
Add VHD to Windows 7 boot menu
(Content stolen from others)
Here's how to add a VHD to Windows 7's boot menu.
- Start BCDEdit as Administrator
- Keep it simple: and copy an existing item (type this literally, but choose a new name)
bcdedit /copy {current} /d "new name here"
This will show you the newly created GUID, which we use in the next commands. - Let the BCD know which files to use (note the square brackets and colon for the drive letter)
bcdedit /set {new GUID} device vhd=[drive:]\<path to your vhd>\<your vhd>.vhd
bcdedit /set {new GUID} osdevice vhd=[drive:]\<path to your vhd>\<your vhd>.vhd
Should you want to change the item's description:
- Find the GUID
bcdedit /enum: - Change description
bcdedit /set {GUID} description "new description here"
For more information about the BCDEdit tool, read the article at TechNet
Install Windows 7/2008 on a VHD
(Content stolen from others)
Here's how to create a bootable VHD.
- Boot from DVD
- When the question for the regional settings appears, press SHIFT-F10. This opens a command prompt.
- Start DISKPART. With this Disk Partition Tool create a VHD file.
- Enter: CREATE VDISK FILE=<path to your vhd>\<your vhd>.vhd TYPE=EXPANDABLE MAXIMUM=20000
- Enter: SELECT VDISK FILE=<path to your vhd>\<your vhd>.vhd
- Enter: ATTACH VDISK
- Exit DISKPART and exit the Command Prompt.
- Continue the Windows installation and when the screen asks on what partition to install Windows, you can now select the newly created VHD! (Ignore any warnings).
For more information about the BCDEdit tool, read the article at TechNet
Auto elevating batchfiles
So, Batch file it is. Got some code from a colleague to get me started, built on it, and ran it from another application I use: mRemote. Alas, no dice. The Batch file needs elevated permissions to start.
There are several ways of doing that, depending on the context you're in, but it would be nice if it would elevate itself. So here's an example of how to do just that. The batch file checks if it has elevated rights, and when not, creates VBScript on the fly and lauches it. The VBScript calls the very same Batch file again with elevated permissions (you still get the prompt for permissions though).
Now, when I forget to run mRemote in elevated mode, the batch file will elevate itself.
The major problem I was/am facing doing this is the fact that it is rather difficult to pass parameters with spaces in it. Fact: I didn't manage. So I resolved to separate paramters with hashes (#) instead.
Here's the code to do all this (I hope nothing got stripped out when posting this).
The interesting bit from elevation point of view are:
- :testUAC
- :doElevation
@echo off
SetLocal enabledelayedexpansion
rem --- Usage ---
rem parameters must be separated by hash signs
rem e.g.: My VPN#My Name#My Password#1
rem Parameters:
rem VPNNAME e.g. My VPN
rem VPNUSERNAME e.g. erp234
rem VPNPASSWORD e.g. xyz123
rem NOPAUSE 0 / 1 ==> whether or not to pause at the end of the script
rem --- Push directory ---
rem In case we are called from withing other hosts
cd /D "%~dp0"
rem --- Deal with parameters ---
for /f "tokens=1-5 delims=#" %%a in ("%*") do (
set VPNNAME=%%a
set VPNUSERNAME=%%b
set VPNPASSWORD=%%c
set NOPAUSE=%%d
)
:testUAC
rem --- Test uac ---
rem We assume %windir% environment variable exists
rem Redirect error messages to NUL
rem THIS WILL FAIL IF DIRECTORY ALREADY EXISTS.
rem IS THERE A BETTER WAY OF CHECKING IF WE ARE ALREADY ELEVATED
mkdir %windir%\uactest 2>nul
if !ERRORLEVEL! == 1 (
goto :doElevation
) else (
rd %windir%\uactest /s /q
)
rem --- START MAIN section ---
:skipElevation
rem --- Stop the VPN ---
rem echo * Bestaande verbinding verbreken (indien aanwezig) : %VPNNAME%
rem rasdial "%VPNNAME%" /disconnect
rem echo.
:startVPN
rem --- Start the VPN ---
echo * Starting VPN : %VPNNAME%
rasdial "%VPNNAME%" %VPNUSERNAME% %VPNPASSWORD%
echo.
if !ERRORLEVEL! == 1 GOTO couldNotStartVPN
rem Reset VPNIP
set VPNIP=
rem Reset ERRORLEVEL
CD > NUL
echo * Identifying received IP from started connection....
ver | find "2003" > nul
if !ERRORLEVEL! == 0 goto getVPNIP_2003
ver | find "XP" > nul
if !ERRORLEVEL! == 0 goto getVPNIP_XP
ver | find "2000" > nul
if !ERRORLEVEL! == 0 goto getVPNIP_2000
ver | find "NT" > nul
if !ERRORLEVEL! == 0 goto getVPNIP_NT
rem --- Speed ---
rem Reg is way faster than SystemInfo
if exist %SystemRoot%\system32\reg.exe goto doReg
if exist %SystemRoot%\system32\systeminfo.exe goto doSysInfo
goto warnOSThenExit
:doReg
set vers=
for /f "tokens=3*" %%i IN ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v ProductName ^| Find "ProductName"') DO set vers=%%i %%j
echo %vers%
goto continueOS
:doSysInfo
set vers=
for /f "delims=: tokens=2" %%i IN ('systeminfo ^| find "OS Name"') DO set vers=%%i
goto continueOS
:continueOS
echo %vers% | find "Windows 7" > nul
if !ERRORLEVEL! == 0 goto getVPNIP_7
echo %vers% | find "Windows Server 2008" > nul
if !ERRORLEVEL! == 0 goto getVPNIP_2008
echo %vers% | find "Windows Vista" > nul
if !ERRORLEVEL! == 0 goto getVPNIP_VISTA
goto warnOSThenExit
rem Reset ERRORLEVEL
CD > NUL
:getVPNIP_nt
goto warnOSThenExit
:getVPNIP_2000
goto warnOSThenExit
:getVPNIP_XP
rem Windows XP
for /f "skip=3 tokens=3" %%a in ('netsh diag show ip Miniport*') do (
set VPNIP=%%a
GOTO createRoutes
)
GOTO couldNotGetVPNIP
:getVPNIP_2003
goto warnOSThenExit
:getVPNIP_VISTA
goto warnOSThenExit
:getVPNIP_7
rem Windows 7
for /f "tokens=3" %%a in ('netsh interface ip show addresses "%VPNNAME%" ^| find "IP Address"') do (
set VPNIP=%%a
GOTO createRoutes
)
GOTO couldNotGetVPNIP
:getVPNIP_2008
goto warnOSThenExit
:couldNotGetVPNIP
echo ! Failed to identify IP address from connection.
GOTO END
:couldNotStartVPN
echo ! Failed to start VPN : %VPNNAME%
GOTO END
:warnOSThenExit
echo ! No implementation for your OS
GOTO END
:createRoutes
echo * Routeringen worden aangelegt voor 'qqq'
route add 'ip1' MASK 255.255.0.0 %VPNIP%
route add 'ip2' MASK 255.255.0.0 %VPNIP%
echo.
:OK
echo * Connection established : %VPNNAME%
:END
if !NOPAUSE! == 1 GOTO ENDNOPAUSE
echo * This window may be closed
pause
:ENDNOPAUSE
set VPNIP=
set VPNNAME=
set VPNUSERNAME=
set VPNPASSWORD=
set NOPAUSE=EndLocal
exit
rem --- elevation routine ---
:doElevation
set str_ElevName="%temp%\elevate.vbs"
echo ' // On the fly created for elevating Batch files > %str_ElevName%
echo ' // (Should also work on other types) >> %str_ElevName%
echo Set objShell = CreateObject("Shell.Application") >> %str_ElevName%
echo Set objWshShell = WScript.CreateObject("WScript.Shell") >> %str_ElevName%
echo Set objWshProcessEnv = objWshShell.Environment("PROCESS") >> %str_ElevName%
echo strDir = "" ^& Wscript.Arguments(0) >> %str_ElevName%
echo strApp = "" ^& Wscript.Arguments(1) >> %str_ElevName%
echo strParam = "" >> %str_ElevName%
echo For i = 3 to Wscript.Arguments.Count >> %str_ElevName%
echo strParam = strParam ^& Wscript.Arguments(i-1) ^& " " >> %str_ElevName%
echo next >> %str_ElevName%
echo objShell.ShellExecute strApp, "" ^& strParam, strDir, "runas" >> %str_ElevName%
start wscript //nologo "%temp%\elevate.vbs" "%cd%" "%~nx0" %*
goto :ENDNOPAUSE
Thursday, February 11, 2010
Virtual PC on Windows 7 without hardware virtualization
... I installed Windows7.... Office 2010 beta.... and some good oldies.....
And then I wanted to use my Virtual Machines that I happened to use A LOT under windows XP. So I searched for Microsoft's Windows Virtual Machine, which offered me to download first XP Mode, and then Windows Virtual PC. Obedient as I am, I did so.
It didn't work. It said I needed Hardware Virtualization. Fine! Opened the BIOS. No dice!
I mean: no virtualization. Flashed the BIOS (one never knows, and one has to try). No dice!
So here I was, stuck with an old T5500 Intel Processor on a HP nx9420 machine, with a nice modern Windows7 that can't run my old VMs.
So, fed up as I was, I went to clean out some hard-disks (I needed the space for VHDs with Server 2008 R2 on it). And one has to pass the time somehow (like 2 kids don't keep me busy enough. Hah!). While browsing through my HardDisks I came across some old version of Virtual PC (64 bit SP1). I figured I'd give it ago (it really sounds like I was bored doesn't it?).
Guess what: runs like a house on fire.
