Tuesday, January 31, 2012

Scripting: Enable 'Run as Administrator' on VBScripts in Context Menu for Windows 7

Its easy to run a batch script under the local Administrator account in Windows 7/Vista as there is an entry for that in the context menu. The option appears when you right click any batch file. VBScripts however are a different matter. After relying on CMD.exe with admin privileges as a workaround one time too many I decided to see if there was a better way! I found a nice registry import on another site that would add a context menu item for launching VBScripts as local admin. I tried it and it worked beautifully, I was able to right-click any .VBS file on my computer and a "Run as Administrator" option appeared and worked every time. Just for grins though I thought I'd try to create my own implementation using REG ADD with Batch. Here is the result:
@ECHO OFF ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: TITLE Enable 'Run as Administrator' on VBScripts in Context Menu for Windows 7 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ECHO Enable 'Run as Administrator' on VBScripts in Context Menu for Windows 7: ECHO. :: Add value for UAC shield icon: REG ADD "HKCR\VBSFile\Shell\runas" /v HasLUAShield /t REG_SZ /d "" /f :: Add value to create context menu item: REG ADD "HKCR\VBSFile\Shell\runas\Command" /ve /t REG_EXPAND_SZ /d "\"%%SystemRoot%%\System32\WScript.exe\" \"%%1\" %%*" /f :: Uncomment "PAUSE" to view script results: ECHO. PAUSE
Hope someone finds it useful.

Monday, January 30, 2012

Tea: Kusmi Tea revamped their site!

Check it out:


While I'm more of  a black tea drinker I decided to get outside my comfort zone and buy some green tea to celebrate:



Also I decided to go out on another limb and try the Polish Earl Grey:


Honestly I did not have high hopes for this one (as the description says its just Earl Grey with Lemon and Lime scents) but I was very surprised to discover that i loved this tea! In fact I'd venture to say that it might be my new favorite! Highly recommended!

SCCM SQL Query: Count known Service Accounts

This query helped me use SCCM to track down some service accounts that were running under the credentials of a recently terminated employee:

SELECT v_GS_SERVICE.StartName0 AS 'Service Account', COUNT(v_GS_SERVICE.StartName0) AS 'Count' FROM v_GS_SERVICE GROUP BY v_GS_SERVICE.StartName0 ORDER BY v_GS_SERVICE.StartName0
Very useful, especially since the services were failing to run because we suspended the account in AD as part of our term process! SCCM to the rescue...

Sunday, January 29, 2012

SCCM: Configuration Manager 2007 R3 and 64-Bit Windows...

So FYI if you write a script to perform a registry edit on a 64-bit Windows OS and try to push it with the ConfigMgr 2007 R3 client yeah you may have issues! See because the client is 32-bit it has this nasty tendency to invoke 32-bit applications! So guess what that means? If you are trying to write changes to the 64-bit registry good luck!!!! Man what a pain...