Lnk, shortcuts – real disaster??

Maybe you noticed that one of my projects I would like to finish in summer is also offline shortcuts editor – and you probably think “why some editor when I can build shortcuts using Explorer?”…

Think twice – it’s not as easy as it looks like and you will be maybe surprised how many gotchas are there.

Problem with .lnk files is that they are WYSINWYG (What You See Is NOT What You Get). Windows is sometimes too “intelligent” – and it can be very, very annoying.

My blog is primarily focused on scripting, deployment and SBC – so I expect that my audience have also some experiences with this. And most people tried to create some shortcut and copy it somewhere else (you create shortcut to some drive letter on your PC and then copy it to desktop of all users for example). Problem is that together with shortcut you provide more information that you know – you provide also last successful resolution of that shortcut and you won’t see this information anywhere in properties of such shortcut.

Let me show you example. You map home drives of your users to H: drive. You want to have shortcut to H:\MyDocs on your desktop. So if you create shortcut to H:\MyDocs, then you just need to distribute it to all your workstations and its done. You open properties of this shortcut and you see that it points to H:\MyDocs, so it should work everywhere, right?

 

WRONG – don’t forget, Windows can be sometimes unpredictable ;) If you open properties of your .lnk file, you can see that it is (still) pointing to H:\MyDocs – however .lnk file also contains information that H:\MyDocs is in fact \\Servers\Administrator$\MyDocs and it will automatically open this folder even from different PC! Quite nasty, right?

And thats not all – try to remove that drive letter and open shortcut – because it remembers that location, it will automatically map H: to \\Servers\Administrator$\MyDocs

If you will try to map something else (\\Servers\Projects) to H: drive, Windows will surprise again – not only it will map that shortcut to different drive (X:), but it will also modify your shortcut so it is automatically changed from H:\MyDocs to X:\MyDocs… Which means that if you have 50 shortcuts pointing to H: drive, 1 accidental click can corrupt that shortcut for you.

 

You can find many (well, not tons of, but still few of them exists) offline shortcuts editors, however most of them covers only situation I described above (and not of all them covers this). There are some bugs that are (as far as I know) not solved by any existing product – for example if you use variables to define your folders (for example %Programs% for D:\Programs), you WON’T be able to create such shortcut if variable is not defined. When you try to create it, C:\ prefix is automatically appended (so %Programs% is in fact pointing to C:\D:\Programs, which is invalid value).

 

Well, this was just quick overview why I want to have offline editor where all such bugs will be fixed (btw I already have first version of code and it works correctly there, so it must be something in Explorer itself)… There are tons of other bugs  – I will try to spend some time testing different results and share results with you. I am now very sorry Microsoft didn’t implement something like XLNK in Windows Vista :(

When is storing configuration in Windows directory good idea?

Well, I know this is quite controversial, but in some cases (specially scripting frameworks) I think it is good idea to use Windows directory to store some settings\configuration…


 Why that? Generally you can always divide such solutions to push or pull (and mixed of course) – that means that (if we talk about servers), sometimes you push some data to server (from your workstation\laptop) and sometimes you want server to retrieve information from some central storage\share.


 Windows directory is suddenly only directory that is easily accessible both locally and remotely – from remote system you can use \\Server\Admin$ and from server itself you can simply use %WinDir% variable.


I know most people would say that you can use \\Server\C$ and %SystemDrive%, but you never know if C: drive really exists (this is happening in SBC environment when you want to have client’s C: drive mapped at C letter).


So for these reasons I like to use Windows directory – and then I make symlink\junction to some other location (so for example C:\Windows\CentralStorage\MyFramework –> C:\MyFramework). That way all required files are easily accessible for scripts (both push and pull) and also for administrators or people working with such environment.


There are of course another ways how to achieve that – create new shares etc, however this method is most reliable and can be easily accessible for all scripts\tools and also for all administrators.


 

SystemSherlockGUI – one package that rules them all ;)

Good news everyone – I just received email from Roger (a.k.a. Kephyr) – he is author of brilliant SystemSherlock. He allowed me to include SystemSherlock in one package with my GUI – so now you can download  one package with both GUI and command line interface :)

 

To remind you, SystemSherlock is snapshoting utility (like Regshot), that can track changes on your filesystem or registry…

Snapshoting is sometimes (often) better than using ProcMon\RegMon\FileMon – you only see real changes, no reads etc… So I prefer snapshoting when I for example want to find where in registry are some changes hapenning.

Compared to RegShot, SystemSherlock is I think much better – you can compare unlimited dumps (not only 1st & 2nd snapshot) and I like GUI more ;)

Download and enjoy :)

P.S.: If you have any feature requests or bugs to report, feel free to contact me, I would like to keep SystemSherlock alive

Upcoming projects – please vote

Heya,


as you maybe know, this summer I would like to focus on some (of course freeware ;)) projects… So here comes list of ideas that I have and you can vote what are you most interested in:


  • Hook Application – I created only POC for this, but I would definitely like to finish it (one day). HA allows you to manipulate with ANY process. You can specify rules for such processes and these rules are automatically performed – for example you can specify that you want to replace that process with another one (for example Iexplore.exe -> Opera.exe), run something before or after process, monitor some applications (so you can track how often you are running such process), lock process by password (if you dont know password, you won’t be allowed to run it), specify rules what to do when one process is running multiple times (so you can change any application to single-instance) etc etc – of course with full support for plugins ;) I was using POC of HA on my laptop for few months – and I love idea of it ;) So the idea is to move HA from POC (with manual configuration etc) to normal utility (with GUI, easy configuration etc).

 


  • Universal Elevator – you probably noticed my recent project Elevator and concept behind… And I was thinking that you can use exactly same concept not just for elevating, but also for runas. So if you would right click any executable, you would have RunAs context menu and under this menu all saved credentials. By selecting credential, executable would run under specified user account. I am still not decided about this – it can be quite dangerous, because you could run anything under different credentials without knowing password of that account.

 


  • Offline shortcuts editor – most peple are probably not affected by this, but if you try to create shortcuts that will be deployed on other computers, you can run into explorer limitations – for example it wont allow you to create shortcut to non-existent file. There are some offline editors, however all of them share same problems – for example you cant use variable that is not defined (if you do so, C:\ prefix will be automatically added).

 


  • AD Groups Overview with CMC support – AD Groups Overview allows you to create map of group memberships – you just specify username\groupname and (based on specified depth) overview of your memberships is automatically visualised (not only your direct group memberships) . I was thinking about adding Citrix support – you would just select some published icons and groups will be automatically detected (and members expanded etc). This way you could easily create picture of all groups that are related to some published icons.

 


  • External drives mapper – I wrote post about mapping external drive to local folder – I love this concept, it is extremely useful specially for card readers (instead of remembering which drive letter is which card, you can create instead folders like SD, MMC etc and free you drive letters), but it is pretty time consuming to migrate your drive letters to folder structure. I was thinking about creating utility that could do that for you.

 


 


  • UPDATE: I forgot one POC I never rewrote to full product – Auto Update (name will definitely change) – small utility that acts as UNIVERSAL auto updater. It will detect new releases based on time stamps (if newer version of file is uploaded, it will recognize it as new release). Current POC (only CLI part) allows you to specify applications that doesn’t contain version numbers in file name (everything from SysInternals), in next release I would like to have nice GUI interface and add features to detect downloads also based on HTML tag (so everything should work)

 


  • UPDATE: Say.exe – I forgot another one :) Few days ago I started using speech recognition in Vista – and I really, really love it :D I disabled dictation mode, so I only use it as replacement of alt+tab, clicking, starting applications etc and success rate is about 95% (which is pretty good number I think). I haven’t used speech recognition for many years – I was really disappointed by numerous statements “Our product have success rate 99%”, when usually such recognition applications were decreasing my productivity instead of increasing it. Not with Vista – that is probably first recognition that really works for me… I plan to write some article with videos about it… Speech recognition allows you to dictate text, command computer and also translate text to speech – and I would like to create really small command line utility where you could simply call say.exe “Script finished successfully” and that way provide some feedback from scripts\applications (instead of including hundreds of wav files or some similar approach). I would like to link that to some events – for example if I would receive new messenger message or mail, I would like it to clearly say New mail arrived or New message arrive or something like this… But first I must create say.exe :D

If you think something is missing or you would like to add anything, just comment :)


Leave comments like VOTE: ADGroupsOverview, HA (suddenly community server have some problems with embedding flash objects, so my voting is not working)


 

Updated Elevator 1.0.0.1

Heya,

based on feedback I made few changes to Elevator and uploaded modified version:

- Works for all extensions, not only .exe

- No need to modify anything – simply run (elevated) Install.cmd

- Should work from any location on filesystem (including Program Files)

 

Martin

Didnt your comment appear on blog?

Heya everyone,


Elevator is much more popular than I expected, and spam likes popular sites  ;) Also I probably found bug in Live Writer – when I publish anything, it will try to add whole post as comment.


So I had to enable moderated comments here – no worries, I am publishing all of them and I dont filter\alter anything.


I just wanted to let you know that if your comment is not posted, just hold on ;)

Changing blog name

Scripting? Sometimes…


Vista? Sometimes…


Deployment? No post for long time…


I was thinking about this for long time and I finally decided to change name of my blog – and because only thing I am sure that won’t change (at least I don’t expect it) for some time is my name, I am changing blog name to it ;)

Elevator – command line

If you tried elevator, you probably know that it is running thought context menu:

image

It is assigned only to exe files (if it is needed, I can extend it)… But sometimes you may want to change shortcut to always run specific action using elevator.

In fact it is pretty easy – just run ElevatorRunner.exe with filename and parameters and you are all set :)

First parameter is executable you want to run and then any command line arguments you want to include.

For example if you want to elevate MMC.exe, simply runs ElevatorRunner MMC.exe and thats it.


To also show example with command line parameters, this is command line I use to run Joost:
C:\Data\SkipUAC\ElevatorRunner.exe “C:\Program Files (x86)\Joost\xulrunner\tvprunner.exe” “C:\Program Files (x86)\Joost\application.ini”

 

In following screenshot you can see few examples:

image

 

It is also pretty easy to modify shortcuts to use Elevator:

image

Martin

SystemSherlock – snapshot using GUI or CMD

Recently I wrote about SystemSherlock Lite – really nice snapshoting tool that supports command line… I also posted small utility for parsing log files.


After that I started to heavily use SystemSherlock – and I must say that it is really really great utility. Problem is that usually you want to have command line AND GUI interface – and SystemSherlock is cmd only :(


So I decided to create wrapper around it – and for me combination of GUI and SystemSherlock is much better snapshoting tool than RegShot or InstallRite…


SystemSherlock GUI consists of 3 different tabs – one for creating snapshots, second for comparing snapshots and third for displaying log files in friendly structure.


Create snapshot


Below is GUI used for taking snapshots:


image


It allows you to create snapshot configuration, specify output file and also to include exclusion list if you want to ignore particular entries. This is configured snapshot for detecting HKCU and C:\Temp folder:


 image


I tried to implement quite logical interface, so there are feature like auto-suggest or auto-repair of entries (for example HKLM is automatically translated HKEY_LOCAL_MACHINE)… Another feature is that entry type is automatically detected (you can see it in video – I don’t select whether entry is registry or filesystem, it is automatically filled):


Update: Embedded video from Jing doesn’t work :( So click on following link instead).


Once you specified what you want to monitor, just click on create button – dump is automatically created. Then do whatever you want – and just click on Create button again. One of SystemSherlock advantages is that it allows you to create as many dumps as you want – you can even compare current dump with one created months ago…


When finished, move to Compare snapshots tab.


Compare snapshots


Below is screenshot of Compare snapshots tab:


image


It is divided to two parts – on left you can see source dumps and on right target dumps. Source dumps are the ones that were taken first –  this is VERY important to understand that source must be always older.


System Sherlock Lite can report unexpected results if you are not aware of this behavior – if you will swap source and target (so target will be older file and source will be newer file), results will be opposite (for example if you deleted folder between snapshots, it will report that this folder was created etc.).


For this reason I implemented some logic to processing. When you select any file on left, ONLY newer files then selected are displayed on right.


 


Parse logs


When you compare two dumps, differences between these two entries are automatically displayed in GUI.


Current version should be already functional, but I am sure that there will be some issues – after all, this is really first version I just finished. If you encounter any problems or you have some features requests, feel free to post them in comments – if nothing, I will at least respond (but probably also implement such changes).


Advantages compared to RegShot:


  • Fully supports command line – can be scripted
  • Imho better GUI
  • Supports multiple dumps – not only comparison of 2 snapshots (easily review historical changes)
  • Exclusion list based on RegExes
  • GUI for reading log files

 Download


Ignore UAC for specific programs

Is it even possible?


First of all, I really like UAC and I think it is big step forward. I got it enabled on my developer PC…


But there are few programs that I run pretty often and UAC can be quite problematic – for example Regedit or MMC. I always run at least 2 programs with highest priorities (Total Commander and CMD session), usually under different account (with higher priorities).


Problem with UAC is that there is no exclusion list… So yesterday I decided it is time to find some workaround.


Result is first version of Elevator – program that will add new Elevate me entry to context menu.


Using this you can bypass UAC without disabling it.


To show you example, MMC always require admin privileges and you must also click that you want to run that program (sorry for no video – got some problems with my web cam).


See what happens when we use Elevator.


 


How does it work?


Few days ago I tried to run some scheduled task that required admin privileges. After some investigation I found out that you can specify that scheduled task can run using highest privileges:



These scheduled tasks don’t prompt you with UAC. First idea that came to my mind was – OK, so if scheduled task runs on demand, then it should in fact disable UAC for specific program? I tried it and it worked… So for some time I was using on demand scheduled tasks – for example instead of running MMC I run Schtasks /Run /TN “Elevated\MMC”.


This was working fine – problem was that you needed to prepare your tasks. So I started to think about some general parser – something universal, easy to implement and use etc.


So I came with idea of two executables – first will prepare “configuration” (what to run etc.) and second will parse this configuration (but from scheduled task).


I tried this concept – Elevate me context menu points to ElevateRunner, ElevateRunner creates configuration in ElevateThis and then runs scheduled task called Elevator that will parse through this folder and run anything in it. Quite advantage is that neither ElevateRunner nor Elevater needs to run – they are not residents programs and they dont monitor something, so they are pretty quick and perform well (whole installation is about 36k).


Concept is definitely not the best, but it works at least for me and compared to ACT solutions it works for every program. This is definitely not solution for normal end users.


If you will decide that you give it a try, let me know if it works for you… I always love to get some feedback (maybe I will change my utilities to feedbackware ;)).


 


Installation


UPDATE: David Phillippo pointed out there was error during installation (hardcoded path was not only in template, but also in reg files). When I tried to fix this, I accidentaly rewrote whole installation script – so there is no need to modify now anything. Just unpack, run install and new context menu should appear. Please dont forget however that you must run Install.cmd in elevated mode!


  1. Download and unpack SkipUAC.zip to any location.
  2. Run Install.cmd – YOU MUST RUN IT ELEVATED! This is final step. Now you should have Elevate me in context menu for all executables and it should work fine.

 


Uninstallation


Uninstallation is pretty easy – simply run Uninstall.cmd script and then you can delete whole folder.


 


Download


Be aware that this is pre-alpha version, only proof of concept that it can be done. Because I try to share as much as possible, I will also provide you with elevator:


 


UPDATE: New version uploaded – it now works for all files, not only exes. If you want to specify some shortcut to always run elevated, check following blog post.