Insidethe.com It is my space, but better than myspace

4Dec/090

How to Launch a WSH VBScript as Administrator in Windows 7 and Vista

The example below launches a VB script as administrator on Windows 7 and Vista regardless if the context menu contains the "Run as administrator" option. Registry tweaks exist to add the run as administrator option to the context menu for .vbs files but this creates complications if the script is distributed to other people.

When the script below is executed it checks to see if it was passed a command line argument named "elevated". If it is not found the script recursively calls itself passing the elevated command line argument and requests to be run as administrator. The user is prompted to confirm the action and the restricted script exits leaving the escalated administrator script running. When the user grants permission the elevated argument is found and the script changes back from the %System32% working directory to the script where the script is located.

If WScript.Arguments.Named.Exists("elevated") = False Then
'Launch the script again as administrator
CreateObject("Shell.Application").ShellExecute "wscript.exe", """" & WScript.ScriptFullName & """ /elevated", "", "runas", 1
WScript.Quit
Else
'Change the working directory from the system32 folder back to the script's folder.
Set oShell = CreateObject("WScript.Shell")
oShell.CurrentDirectory = CreateObject("Scripting.FileSystemObject").GetParentFolderName(WScript.ScriptFullName)
MsgBox "Now running with elevated permissions"
End If
'
'
If WScript.Arguments.Named.Exists("elevated") = False Then
	'Launch the script again as administrator
	CreateObject("Shell.Application").ShellExecute "wscript.exe", """" & WScript.ScriptFullName & """ /elevated", "", "runas", 1
	WScript.Quit
Else
	'Change the working directory from the system32 folder back to the script's folder.
	Set oShell = CreateObject("WScript.Shell")
	oShell.CurrentDirectory = CreateObject("Scripting.FileSystemObject").GetParentFolderName(WScript.ScriptFullName)
	MsgBox "Now running with elevated permissions"
End If

Filed under: Programming, Tech No Comments
11Nov/090

IIS 7 AppCmd Example – Changing Default ISAPI Settings

The default ISAPI settings in IIS 7 and later reference %windir% in the path. Changing these settings with a script using AppCmd requires special handling of the % character because it is a reserved character in the AppCmd utility. The % character is and operator to indicate the start of a Unicode character value.

To set values with extended characters using the IIS 7 AppCmd utility you must specify the Unicode value.

For example, to change the value of an ISAPI restriction from true to false on a setting with a relative path issue the command:

appcmd set config /section:system.webServer/security/isapiCgiRestriction /[path='%u0025windir%u0025\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll"'].allowed:false

The sequence %u0025 is the Unicode value of the % character.

r%u0025\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll"'].allowed:true

Filed under: Tech No Comments
2Nov/090

CounterPath Corporation EyeBeam License Maintenance Link

For those of you who use the eyeBeam VoIP phone client and can't find the license account maintenance page on the couterpath.com website here it is:

https://secure.counterpath.com/Store/CounterPath/Members/Account/ListLicenses.aspx

The page will allow you to login and re-assign or revoke licenses. This is especially useful if you happen to sift between a home desktop PC and laptop.

I've been happily using eyeBeam for almost a year with my BroadVoice SIP accounts until CounterPath changed the license mechanism. It is almost impossible to find the license maintenance link on the main CounterPath page. The client doesn't link to the maintenance site either. Argh!

I am not affiliated with CounterPath other than I use eyeBeam.

Filed under: Tech No Comments
10Oct/090

Give Google An Answer To Find the Question!?

This is a anecdote of how Google gave the question to the answer I already had.

Normally, people input questions and keywords into Google to find an answer. In my case the answer was known. Use caspol.exe with the -pub -file arguments to trust all the assemblies signed with my certificate. The MSDN caspol.exe documentation was helpful but the exact syntax for implementing the command was a little fuzzy.

When in doubt Google it. Behold, the question to my answer stated in a question:

"What does this statement do? caspol -machine -addgroup All_Code -pub -file MyApp.exe FullTrust"

Thanks to Matthew Podwysocki his question fit my answer and provided the syntax needed to complete my work with caspol.

Filed under: Programming, Tech No Comments
27Sep/093

Installing Windows 7 on an Acer One A0751H Netbook

This is a short overview of my experience installing Windows 7 on my new Acer Aspire One Netbook model A0751H. It wasn't out of the box for more than an hour before I wondered if I could replace the existing Windows XP Home OS with the new Windows 7 x86 OS. As it turned out, it is easily done.

  1. Connect netbook to USB cd/dvd drive. The computer boots through the BIOS quickly but continually pressing F12 brought up the boot device selection menu.
  2. Install Windows 7 as usual. I choose to install Windows 7 x86 Ultimate Edition. The install should complete without an issue.
  3. Install the video drivers. Windows 7 didn't have a driver for the internal Intel Graphics Media Accelerator 500 and it wouldn't display the exotic 1366x768 resolution until the proper driver was in place. Download the VGA driver from the A0751H drivers and download Acer support section. As of today the most recent VGA driver is VGA_Intel_v.7.14.10.1095_VistaX86.zip To successfully install the driver you must change the properties of setup.exe in the driver package. Set the program compatibility level to Windows XP SP 3. Otherwise the installer will fail with an error that the version of windows is not supported.
  4. Install the other drivers from the support page as needed using the same steps as the video driver.

SDC10662 - Copy (889x1024)

The system handles Windows 7 better than anticipated but the slow processor and 1 GB of memory are evident bottlenecks. Turning off desktop composition to optimize the system for performance instead of visual appearance resulted in a noticeable speed improvement.

Instead of installing the Synaptics touchpad driver I relied on the standard driver. As a result the special touchpad gestures didn't function.

Occasionally the system would lock up for no apparent reason. The mouse would stop responding forcing me to do a hard reset. I suspect this could be a driver issue but without proper drivers it didn't make sense to push forward debugging the situation.

In summary, the system is sluggish but usable. If it hadn't been for the sporadic system lockups I would have continued to run Windows 7. For now, I'm back to using XP Home.

Filed under: Tech 3 Comments